View Single Post
 
Old 05-14-2013, 02:45 AM
bakerkr bakerkr is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: May 2013
Posts: 2
bakerkr is on a distinguished road
Default Macro to highlight a list of words

I came across a macro that will highlight a certain word, in the below example I used the word to.

I'd like to use a list of words, which will allow me to add or delete words as necessary. Is this possible? VBA is okay instead of a macro.

Thanks
Kevin
Code:
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Highlight = True
With Selection.Find
  .Text = "to"
  .Replacement.Text = "to"
  .Forward = True
  .Wrap = wdFindContinue
  .Format = True
  .MatchCase = False
  .MatchWholeWord = False
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Options.DefaultHighlightColorIndex = wdYellow
Selection.Range.HighlightColorIndex = wdYellow

Last edited by macropod; 05-14-2013 at 08:25 PM. Reason: Added code tags & formatting
Reply With Quote