Word macro doesn't remember colors!

J

Joy

What am I doing wrong? Word 2003 on XP SP2.

I want a macro to change all occurances of Piano to be shown in bold and
red. I recorded the macro and it worked at that time. But using the macro
does not work. You can see that the replacement information such as bold
and color is not recorded.

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Piano"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll


I tried

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Piano"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
With Selection.Find.Replacement
.Text = "\1"
.Font.Color = wdBlue
.Font.Bold = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

but that didn't work either.

Why does Word not record this correctly and how can I fix it?

Thank you!

Joy
 

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