Need to Loop code

2

2Catman

I need to loop the following code until the end of a document (of
comma-delimited library records):

Sub Test_find_count()
'
' Test_find_count Macro
' Macro recorded 12/5/2005 by
'
Selection.Find.ClearFormatting

With Selection.Find
.Text = ""","
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With

For X = 1 To 11
Selection.Find.Execute
Next X

Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=", "

With Selection.Find
.Text = "^p"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute


End Sub
 

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