J
John Svendsen
Hi All:
I'm trying to build a Macro to replace all words in a document, except for
words whose color is green
I've tried the following code, first trying to use
"Selection.Find.Font.Color <> wdColorGreen" - but it doesn't like the "<>"
Then I though of replacing all colors except Green, but to my surprise ALL
words are changed (even the green words)
Could someone please shed some ligh on what I'm doing wrong? Or point me out
some other smarter way to go about this?
Thanks for your kind attention and help
Rgds, JS
Sub REPLACOLOR()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Font.Color = wdColorAutomatic
With Selection.Find
.Text = "UP"
.Replacement.Text = "DOWN"
.Forward = True
.Wrap = wdFindContinue
.Wrap = wdFindStop
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
I'm trying to build a Macro to replace all words in a document, except for
words whose color is green
I've tried the following code, first trying to use
"Selection.Find.Font.Color <> wdColorGreen" - but it doesn't like the "<>"
Then I though of replacing all colors except Green, but to my surprise ALL
words are changed (even the green words)
Could someone please shed some ligh on what I'm doing wrong? Or point me out
some other smarter way to go about this?
Thanks for your kind attention and help
Rgds, JS
Sub REPLACOLOR()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Font.Color = wdColorAutomatic
With Selection.Find
.Text = "UP"
.Replacement.Text = "DOWN"
.Forward = True
.Wrap = wdFindContinue
.Wrap = wdFindStop
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub