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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top