I currently have a macro that finds text and places a page break in front of it, which works fine. The problem is I have a variable number of blank lines before each page break. I would like that variable number to be 3. Currently I am doing a find replace many times and replacing
^p^p^p^p
with
^p^p^p
I am wondering if there is a way to loop through the word document to perform this instead of me doing a find and replace 20+ times?
My macro to insert the page break is
Dodge20
^p^p^p^p
with
^p^p^p
I am wondering if there is a way to loop through the word document to perform this instead of me doing a find and replace 20+ times?
My macro to insert the page break is
Code:
Dim strData As String
strData = InputBox("Paste Text where you want the page break inserted")
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = (strData)
.Replacement.Text = "^m" & (strData)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
ActiveWindow.ActivePane.VerticalPercentScrolled = 0
End Sub
Dodge20