The script below is supposed to highlight certain keywords in the text that was just pasted. The problem is that it's only highlighting the first keyword in the array, without any results for the rest of the keywords.
What could be the problem, please?
Alex
Code:
Dim pasted_content As Word.range
Dim r As Long
Dim Keywords
Keywords = Array("keyword1", "keyword2", "keyword3")
Set pasted_content = Selection.range
pasted_content.Paste
For r = 0 To UBound(Keywords)
With pasted_content.Find
.Text = Keywords(r)
.Format = True
Do While .Execute(Forward:=True) = True
pasted_content.HighlightColorIndex = wdYellow
Loop
End With
Next