Re: Apply a user-defined character style to all ocurrences of manual bold formatting but skipping some specific paragraphs
- From: Helmut Weber <red.sys@xxxxxxxxxxx>
- Date: Mon, 28 Jul 2008 17:09:21 +0200
Hi Andreas,
what about the idea, that the command
range.font.reset
reveals, whether there was formatting manually applied?
Something along these lines, maybe:
Sub Macro7()
Dim rDcm As Range
Set rDcm = ActiveDocument.StoryRanges(wdMainTextStory)
With rDcm.Find
.Font.Bold = True
While .Execute
rDcm.Font.Reset
' rDcm.Select ' for testing
If rDcm.Font.Bold = False Then
rDcm.Style = "BoldStyle"
End If
' rDcm.Select ' for testing
rDcm.start = rDcm.End
rDcm.End = ActiveDocument.StoryRanges(wdMainTextStory).End
Wend
End With
End Sub
If you create a new range, by
Set rDcm = ActiveDocument.StoryRanges(wdMainTextStory)
it is not necessary to care about find.options like
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
etc.
All options are set to their default values.
However, I don't know, what they are. ;-)
Also
activedocument.range seems to be equivalent to
ActiveDocument.StoryRanges(wdMainTextStory).
But I'm not sure about that either.
Whithout covering all possible complications, of course,
cheers
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Vista Small Business, Office XP
.
- Follow-Ups:
- References:
- Prev by Date: Re: Dealing with Tables in VBA
- Next by Date: Re: Dealing with Tables in VBA
- Previous by thread: Apply a user-defined character style to all ocurrences of manual bold formatting but skipping some specific paragraphs
- Next by thread: Re: Apply a user-defined character style to all ocurrences of manual bold formatting but skipping some specific paragraphs
- Index(es):
Relevant Pages
|