View Single Post
 
Old 07-09-2014, 11:28 PM
gekser gekser is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jul 2014
Posts: 5
gekser is on a distinguished road
Default What about that macro

Dear Paul, thank you for prompt reply.

Somewhere in the Internet I found the following macro.

Code:
Sub HighlightRepeatedWords()
'
' HighlightRepeatedWords
'
Dim oRng As Word.Range
Dim arrWords
Dim i As Long
arrWords = Array("work", "dialogue", "would like", "first of all")
For i = 0 To UBound(arrWords)
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = arrWords(i)
    .MatchWholeWord = False
    .Replacement.Highlight = True
    ' .MatchCase = True
    .Execute Replace:=wdReplaceAll
  End With
Next
End Sub
It was yours but with a different name. My task is to use not just 4 (four) words as an array but 160. VB does not allow me to use so many words in a single string.

I do not mind if all of the words needed are highlighted by one color.

Could you suggest what to do in this case?
Reply With Quote