I've just started programming and this is my first shot solo.
I'm trying to insert a page break at every instance where "Total Amount Payable:" occurs. I've gone to different pages to start the code...but with the code I have now, nothing executes, the cursor just ends up at the end of the doc. Here it is (don't laugh)
Public Sub Page_Breaks()
Do Until ActiveDocument.Bookmarks("\Sel") = ActiveDocument.Bookmarks("\EndOfDoc")
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Total Amount Payable:"
.MatchWildcards = False
.Replacement.Text = ""
.Wrap = wdFindStop
.Forward = True
End With
Selection.Find.Execute
If Selection.Find.Found = True Then
Selection.InsertBreak (wdPageBreak)
Else
Exit Do
End If
Loop
End Sub
Please let me know what I'm doing wrong....AGAIN, first timer.
Thanks! Haedyr
I'm trying to insert a page break at every instance where "Total Amount Payable:" occurs. I've gone to different pages to start the code...but with the code I have now, nothing executes, the cursor just ends up at the end of the doc. Here it is (don't laugh)
Public Sub Page_Breaks()
Do Until ActiveDocument.Bookmarks("\Sel") = ActiveDocument.Bookmarks("\EndOfDoc")
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Total Amount Payable:"
.MatchWildcards = False
.Replacement.Text = ""
.Wrap = wdFindStop
.Forward = True
End With
Selection.Find.Execute
If Selection.Find.Found = True Then
Selection.InsertBreak (wdPageBreak)
Else
Exit Do
End If
Loop
End Sub
Please let me know what I'm doing wrong....AGAIN, first timer.
Thanks! Haedyr