Find/Replace Loop - argh !
Hi there,
I am trying to run a simple macro (which I did by recording it) that looks for style "TableAnchor", replaces the line of it with another style, and puts another paragraph in after it in a third style.
No problems. But I want to do it for every instance of "TableAnchor" style. And I am stumped as to where and what sort of loop to use.
Any hints would be reaaaaaaaaallllllllly appreciated.
Here's my macro so far:
Sub replacingstyles()
'
' replacingstyles Macro
' Macro recorded 10/03/04 by elizabeth.dent
'
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("TableAnchor")
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Style = ActiveDocument.Styles("Body Text")
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.Style = ActiveDocument.Styles("TableAnchor1point")
End Sub