Although this forum is for Access VBA, Word is easier to create macros. While you have Word open, you can 'record' a macro. Go to Tools > Macro > Record. Take the steps necessary to obtain the objective. Meaning, click CTRL+H. Enter w1 as the search criteria. Enter w1 as the Replace value. Click More >>, Format and then Font. Select the font color to change your item (I selected Red). Click Replace All. After replacing has finished, change the w1 values to w2 and run again. Stop the macro. This is what it should generate:
Sub FindChangeFont()
'
' FindChangeFont Macro
' Macro recorded 1/28/2004 by Beth Moffitt
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "w1"
.Replacement.Text = "w1"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "w2"
.Replacement.Text = "w2"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Regards,
Beth M
|