The following macros will highlight (and remove the highlight) from a list
of words set in quotes and separated by commas in the line vFindText =
Sub HighlightList()
Dim rDcm As Range
Dim vFindText As Variant
Dim i As Long
Set rDcm = ActiveDocument.Range
'*************************************************
vFindText = Array("Lorem", "dolor", "amet")
'*************************************************
'Selection.HomeKey Unit:=wdStory
With rDcm.Find
.Forward = True
.Wrap = wdFindStop
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = True
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = "^&"
.Replacement.Highlight = True
.Execute replace:=wdReplaceAll
Next i
End With
End Sub
Sub RemoveHighlight()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = ""
.Highlight = True
.Replacement.Text = "^&"
.Replacement.Highlight = False
.Execute replace:=wdReplaceAll
End With
End Sub
http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>