Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help! Word replace format through vba...

Status
Not open for further replies.

jmswe

Programmer
Feb 14, 2002
31
GB
Im in trouble!

I want to replace all instances of heading 1 in a document with heading 2.... no problem if you do it manually through the menus. But if i record i macro the macro dont do a thing!

This is the code that dont do anything:

Selection.Find.Style = wdStyleHeading1
Selection.Find.Replacement.Style = wdStyleHeading2
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

Extrmely annoying!

What do i do?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top