Macro VBA help

Joined
10 May 2004
Posts
12,932
Location
Sunny Stafford
Hiya. I have some code that I've written already and I would like to modify its function slightly. The macro searches through a Word document for the word "Overclockers" and formats it to the colour lilac. It repeats itself until the end of the document. Please see the code below:

Code:
Sub FormatWords()
   Selection.Find.ClearFormatting
   Selection.Find.Replacement.ClearFormatting
   With Selection.Find
        .Text = "Overclockers"
        .Replacement.Text = ""
        .Replacement.Font.Color = RGB(160, 160, 255)
        .Forward = True
        .Wrap = wdFindContinue
        .MatchWholeWord = True
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
End Sub

What I would like it to do is to format a line containing that string and not just the word itself. Can anyone offer advice on this please?

Thanks.
 
Back
Top Bottom