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?
Jezebel - 21 Apr 2006 23:50 GMT
Bug in your code is the most likely answer.
>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?
Cooz - 24 Apr 2006 12:36 GMT
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
--
PS: If this is a satisfying answer to your question and you're logged in via
the Microsoft site, please click Yes to "Did this post answer the question?".
Thanks.
> 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?