Re: Apply a user-defined character style to all ocurrences of manual bold formatting but skipping some specific paragraphs
- From: andreas <andreas.hermle@xxxxxx>
- Date: Wed, 30 Jul 2008 03:25:34 -0700 (PDT)
On 28 Jul., 17:09, Helmut Weber <red....@xxxxxxxxxxx> wrote:
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
Hey Helmut,
thanks for the quick answer. I ran it for about 15 min on a document
with 50 pages. I interrupted it since I thought that it had fallen
into an endless loop. I will do some longer testing and let you then.
Regards, Andreas
.
- References:
- Prev by Date: Re: Finding any sequence of 3 identical characters
- Next by Date: Re: How to check if a input textbox contains numerical values only?
- Previous by thread: Re: Apply a user-defined character style to all ocurrences of manual bold formatting but skipping some specific paragraphs
- Next by thread: Finding any sequence of 3 identical characters
- Index(es):
Relevant Pages
|