Applying Styles

C

Chuck Henrich

This should do it:


Sub ApplyStyleToPhrase()

Dim rng As Range

Set rng = ActiveDocument.Range

With rng.Find
.ClearFormatting
.Replacement.ClearFormatting
.Wrap = wdFindStop
.Text = "my phrase"
While .Execute
rng.Style = "Emphasis"
'apply a character style to just change
'to change the formatting for just the phrase
'or a paragraph style to change the formatting
'for the paragraph the phrase appears in
Wend
End With

End Sub

HTH
 
Top