View Single Post
 
Old 06-05-2013, 07:44 AM
String String is offline Windows XP Office 2007
Novice
 
Join Date: Jun 2013
Posts: 3
String is on a distinguished road
Default

Sure,

This is the macro code I am using to highlight each separate word. Its a very lightly modified code I found on these forums.

Code:
Sub HiLightList()
Application.ScreenUpdating = False
Dim StrFnd As String, Rng As Range, i As Long
StrFnd = "yellow,green,dog,horse"
For i = 0 To UBound(Split(StrFnd, ","))
  Set Rng = ActiveDocument.Range
  With Rng.Find
    .ClearFormatting
    .Text = Split(StrFnd, ",")(i)
    .Replacement.ClearFormatting
    .Replacement.Highlight = True
    .Replacement.Text = "^&"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = True
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute Replace:=wdReplaceAll
  End With
Next
Set Rng = Nothing
Application.ScreenUpdating = True
End Sub
So once its found and highlighted these words, I need it to wrap an HTML tag around them all.

Thx
Reply With Quote