View Single Post
 
Old 01-29-2017, 05:52 AM
jamesnavoy jamesnavoy is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Jan 2017
Posts: 2
jamesnavoy is on a distinguished road
Default issue with highlight macro word 2010

Hi guys, I'm looking for help with a simple find and highlight words macro. this macro i was trying out seems to only be able to highlight with the currently active highlighted color, not the replacement color mentioned in the macro so I was wondering why that might be happening? and secondly i would like to do 3 set of the same routine, different colors for different words. how do i ammend this to achieve it please?

Code:
Sub ListChange()
Dim r As Range
Dim MyList() As String
Dim i As Long
MyList = Split("challenging,difficult,down by,", ",")
For i = 0 To UBound(MyList())
   Set r = ActiveDocument.Range
      With r.Find
         .Text = MyList(i)
         .Replacement.Highlight = wdGreen
         .Execute Replace:=wdReplaceAll
      End With
Next
End Sub

Last edited by macropod; 01-30-2017 at 12:27 AM. Reason: Added code tags to restore formatting
Reply With Quote