Re: reset font format to default but keep the bold formatting..>> by Klaus
Klaus
Sat Mar 25 14:06:35 CST 2006
Hi Helmut,
Interesting approach, looks well optimized! Though 3 replacements and
"FontReset" on the whole doc is likely pretty fast, too...
Not sure what program would "win".
It might depend on the specifics of the document (how large? how much bold
text? ...).
Regards,
Klaus
"Helmut Weber" <nbhymsjxdgcn@mailinator.com> wrote:
> Hi Klaus,
>
> how about this one,
> coded with respect to speed
> and with respect to avoiding repagination by inserting tags,
> at least to some extend.
>
> I think in principle it could be used in quite a variety of cases:
>
> Sub test000()
> Dim oPrg As Paragraph
> Dim rWrd As Range
> Dim rChr As Range
> For Each oPrg In ActiveDocument.Paragraphs
> If oPrg.Range.Font.Bold = False Then
> oPrg.Range.Font.Reset
> ElseIf oPrg.Range.Font.Bold = True Then
> oPrg.Range.Font.Reset
> oPrg.Range.Font.Bold = True
> ElseIf oPrg.Range.Font.Bold = 9999999 Then
> For Each rWrd In oPrg.Range.Words
> If rWrd.Font.Bold = False Then
> rWrd.Font.Reset
> ElseIf rWrd.Font.Bold = True Then
> rWrd.Font.Reset
> rWrd.Font.Bold = True
> ElseIf rWrd.Font.Bold = 9999999 Then
> For Each rChr In rWrd.Characters
> If rChr.Font.Bold = True Then
> rChr.Font.Reset
> rChr.Font.Bold = True
> ElseIf rChr.Font.Bold = False Then
> rChr.Font.Reset
> End If
> Next
> End If
> Next
> End If
> Next
> End Sub
>
>
> I am not sure, whether formatting something as bold,
> which is bold anyway, may cause problems sometime.
>
> --
> Gruß aus Landsberg am Lech
>
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP WordVBA
>
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"