Quote Originally Posted by macropod
Hi HJ,

Try something along these lines:
Sub Demo()
Dim oRng As Range, arrWords, i As Long, HiLite As Variant
Set oRng = ActiveDocument.Range
With oRng.Find
  arrWords = Array("very", "high")
  .ClearFormatting
  .Replacement.ClearFormatting
  .MatchWholeWord = False
  .Replacement.Text = "^&"
  .Replacement.Highlight = True
  HiLite = Options.DefaultHighlightColorIndex
  Options.DefaultHighlightColorIndex = wdYellow
  For i = 0 To UBound(arrWords)
    .Text = arrWords(i)
    .Execute Replace:=wdReplaceAll
  Next
  Options.DefaultHighlightColorIndex = HiLite
  arrWords = Array("the", "list", "of", "words", "to", "exclude")
  .Replacement.Highlight = False
  For i = 0 To UBound(arrWords)
    .Text = arrWords(i)
    .Execute Replace:=wdReplaceAll
  Next
  arrWords = Array("I think that")
  .Replacement.Highlight = True
  HiLite = Options.DefaultHighlightColorIndex
  Options.DefaultHighlightColorIndex = wdBrightGreen
  For i = 0 To UBound(arrWords)
    .Text = arrWords(i)
    .Execute Replace:=wdReplaceAll
  Next
  Options.DefaultHighlightColorIndex = HiLite
End With
Set oRng = Nothing
End Sub
Note: Contrary to my previous advice, the above approach obviates the need to set up a loop for pocessing the green highlights by selection the found ranges. You'll also see how, in this iteration of the code, I've captured and restored the previous highlighting attaributes.

Good morning,

apologies for dragging up this useful thread

Can someone help me with a quick query?

With regards to the code above, is it - and if so can someone show me - possible to display a message if one of the words listed in the array is found? Ie if "turkey" was listed and found by the macro it would display the message "You Have Entered a Restricted Word"

Many thanks, very useful site.