Code:
Sub HiLightList()
Application.ScreenUpdating = False
Dim StrFnd As String, StrRep As String, i As Long
StrFnd = "if,then,from,to,all,first,between,first,last,of,and,or,print,find,swap," & _
"check,print,count,when,require,do not,with,but,rather than,where,is not,as,in,an," & _
"is,by,are,on,for,because,some,before,after,also,under,inside,around,into,next to," & _
"often,let,delete,copy,find,calculate,check,print,until,was,were,behind,had been"
StrRep = "if,then,from,to,all,first,between,first,last,of,and,or,print,find,swap," & _
"check,print,count,when,require,do not,with,but,rather than,where,is not,as,in,an," & _
"is,by,are,on,for,because,some,before,after,also,under,inside,around,into,next to," & _
"often,let,delete,copy,find,calculate,check,print,until,was,were,behind,had been"
With ActiveDocument.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Highlight = True
.Format = True
.Forward = True
.MatchCase = False
.MatchWholeWord = True
.Wrap = wdFindContinue
For i = 0 To UBound(Split(StrFnd, ","))
.Text = Split(StrFnd, ",")(i)
.Replacement.Text = "^l" & Split(StrRep, ",")(i)
.Execute Replace:=wdReplaceAll
Next
End With
Application.ScreenUpdating = True
End Sub
Note how the long lines are broken. The StrFnd and StrRep variables must have the same # of elements. Also note how the F/R code has been made more efficient by moving most of it outside the loop.