View Single Post
 
Old 05-14-2013, 06:15 PM
fumei fumei is offline Windows 7 64bit Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

Quote:
VBA is okay instead of a macro.
They are the same. VBA = macros. macros = VBA

Code:
Sub ListChange()
Dim r As Range
Dim MyList() As String
Dim i As Long
MyList = Split("dot,com,like", ",")
For i = 0 To UBound(MyList())
   Set r = ActiveDocument.Range
      With r.Find
         .Text = MyList(i)
         .Replacement.Highlight = wdYellow
         .Execute Replace:=wdReplaceAll
      End With
Next
End Sub
The code highlights all instances of the words in the list (dot, com, like).

Note that nothing is selected.
Reply With Quote