Hello Everybody.
I have a code able to highlight all the words in the string

keywords = "if,then,from,to,all,first,between,first,last, of); and start a new line for each one.
My request here is:
first, my list is really long -SO- how can I break it or separated in different lines.
Second: how to replace each word in the list for different replacement for each one.
This is the code I have:
Code:
Sub HiLightList()
Application.ScreenUpdating = False
Dim keywords As String, Rng As Range, i As Long
keywords = "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"
For i = 0 To UBound(Split(keywords, ","))
Set Rng = ActiveDocument.Range
With Rng.Find
.ClearFormatting
.Text = Split(keywords, ",")(i)
.Replacement.ClearFormatting
.Replacement.Highlight = True
.Replacement.Text = "^l^&"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = True
.MatchWholeWord = True
.Execute Replace:=wdReplaceAll
End With
Next
Set Rng = Nothing
Application.ScreenUpdating = True
End Sub
Thank you for reading this post.