MWE
04-24-2006, 04:45 PM
I am using Find to find specific text in the current Selection and then "operate" on that text. In particular, I want to change the text font to dark red and HighLight the text area with Yellow. The relevant code is:
With Selection.Range.Find
.Text = TargetText
With .Replacement
.Font.Color = wdColorDarkRed
.ParagraphFormat.Shading.BackgroundPatternColor = wdColorYellow
End With
.Execute Format:=True, Forward:=True, Replace:=wdReplaceAll
End With
Using the object browser to explore the properties of Replacement, it seemed that the above should work. I get no error and the font color is correctly changed; but the "background" is not changed. So I am doing something wrong.
Any help would be appreciated.
With Selection.Range.Find
.Text = TargetText
With .Replacement
.Font.Color = wdColorDarkRed
.ParagraphFormat.Shading.BackgroundPatternColor = wdColorYellow
End With
.Execute Format:=True, Forward:=True, Replace:=wdReplaceAll
End With
Using the object browser to explore the properties of Replacement, it seemed that the above should work. I get no error and the font color is correctly changed; but the "background" is not changed. So I am doing something wrong.
Any help would be appreciated.