Fellow MVP Greg Maxey is away this week or he would have pointed out his web
link - http://gregmaxey.mvps.org/Find_it_tool_bar.htm which would be a means
to do what you want. This allows you to easily highlight words in different
colours.
I also have a macro for highlighting lists of Words which could be adapted
to your own requirements. Replace the words in the vFindText arrays with
your own words. You can continue the theme with other colours and words as
required.
Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long
'highlight red words
Options.DefaultHighlightColorIndex = wdRed
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
vFindText = Array("anger", "violence", "fighting")
vReplText = "^&"
With Selection.Find
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = False
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText
.Replacement.Highlight = True
.Execute replace:=wdReplaceAll
Next i
End With
'Highlight blue words
Options.DefaultHighlightColorIndex = wdBlue
vFindText = Array("depression", "misery")
vReplText = "^&"
With Selection.Find
.Forward = True
.Wrap = wdFindContinue
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText
.Replacement.Highlight = True
.Execute replace:=wdReplaceAll
Next i
End With
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Post by davegeorge7I don't mind building a Macro to do this, but Find/Replace is too limited in
its text translation capabilities. The key is that certain words 20 or so
need to be color highlighted with specific colors, like "depressed" will
always be highlighted Blue and "angry" will always be highlighted
Red. These words will not change over time, but some new words may
be added. The
easiest way is to have a list of words to search for and an "action"
associated with each word, e.g if "depressed", then "Highlight Blue".
This
dies not seem hard to do programatically, but maybe there is a macro or
program out there that already does it so I don't end up reinventing the
wheel? Thanks for your thoughts on this.
Post by Daiya MitchellAn "after the fact" alternative would be Find & Replace, you have to click
on More to get access to formatting commands in the F&R box.
If the keyword list changes often, you could probably create a macro
that would make it easy to plug in new keywords. If always the same
keywords, setting up the AutoCorrects is probably better.
Post by Martin PAutoCorrect Options should work for this. Suppose you always want
"keyword" to be in bold. Type the word, highlight it and change the
format to bold. Go to Tools, AutoCorrect Options and type "keyword"
on the left-hand side. Choose formatted text and press OK.
Post by davegeorge7How can I automatically color hightlight key words in a Word
document, based upon a supplied keyword list or table? As a macro
function or some other pre-process?