search and replace style - 1st line correct style, but wrong font

F

FrankFromWisconsin

I have a macro that searches and replace one style for another. This worked
fine until we upgraded to Word 2003. Now, the first line gets the style
applied, but the font doesn't change. The find must be working, but why
doesn't the font change?
 
C

Cooz

Hi Frank,

Record the macro again in 2003, or use this one:

Sub ReplaceStyle()
With Selection.Find
With .Replacement
.ClearFormatting
.Replacement.Style = ActiveDocument.Styles("ReplaceByStyle2")
.Text = ""
End With
.ClearFormatting
.Style = ActiveDocument.Styles("ReplaceStyle1")
.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.Execute Replace:=wdReplaceAll
End With
End Sub

Good luck,
Cooz
 
Top