Find all the words appearing in red

C

cyberdude

Hi,

I would like to write a Word VBA macro to find all the words appearing
in red. Here is part of the code:

Sub test1()

Selection.Find.Font.Color = wdColorRed
Selection.Find.Execute
MsgBox (Selection.Text)

End Sub

But it can't find ALL such words but only the first encounter of such
a word. Can you tell me the rest of the code that makes it search
throughout the document? Thanks.

Mike
 
T

Tony Strazzeri

Hi Dude! (couln't resist that <g>)

Try the following .

Cheers!
TonyS.

With Selection.Find
.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.Format = True
.Font.Color = wdColorRed
End With


While Selection.Find.Execute
MsgBox (Selection.Text)
Wend
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top