I have a small macro that I have written in MS Word 2000. The macro does a search then types a few characters. I need to put the macro into a loop, until it has searched the whole document. How do I do this?
Below is the text of the macro:
Sub Macro7()
'
' Macro7 Macro
' Macro recorded 10/09/02 by Les Bentley
'
Selection.HomeKey Unit:=wdStory
Selection.HomeKey Unit:=wdLine
Selection.Find.ClearFormatting
With Selection.Find
.Text = "targetGeom"
.Replacement.Text = "k 0 0"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
With Selection.Find
.Text = "k"
.Replacement.Text = "k 0 0"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="k 0 0"
Selection.TypeParagraph
End Sub
Below is the text of the macro:
Sub Macro7()
'
' Macro7 Macro
' Macro recorded 10/09/02 by Les Bentley
'
Selection.HomeKey Unit:=wdStory
Selection.HomeKey Unit:=wdLine
Selection.Find.ClearFormatting
With Selection.Find
.Text = "targetGeom"
.Replacement.Text = "k 0 0"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
With Selection.Find
.Text = "k"
.Replacement.Text = "k 0 0"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="k 0 0"
Selection.TypeParagraph
End Sub