Hi - this macro should find "Invoice=" and then select from the previous page
break to the following page break and delete. It's deleting multiple pages.
Any ideas why? I really appreciate the help:
Sub BillAdd1()
'
With Selection
.WholeStory
.ExtendMode = False
.Collapse
End With
With Selection.Find
.Text = "invoice="
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
While .Execute
' Selection.Find.Execute
Selection.HomeKey unit:=wdLine
With Selection.Find
.Text = "^m"
.Replacement.Text = ""
.Forward = False
.Wrap = wdFindStop
'.Wrap = wdFindAsk
End With
Selection.Find.Execute
Selection.MoveRight unit:=wdCharacter, Count:=1
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^m"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
End With
Selection.Find.Execute
Selection.Delete unit:=wdCharacter, Count:=1
Selection.MoveDown unit:=wdLine
Wend
End With
End Sub
Doug Robbins - 03 Mar 2005 02:10 GMT
Once you find the "Invoice=", delete the range of the built-in bookmark
"\page"
Selection.Bookmarks("\page").Range.Delete

Signature
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.
Hope this helps,
Doug Robbins - Word MVP
> Hi - this macro should find "Invoice=" and then select from the previous
> page
[quoted text clipped - 55 lines]
>
> End Sub
Julia - 03 Mar 2005 02:47 GMT
Thanks Doug. I don't know enough to know where to place that line of code
you gave me, but I'm trying. thanks
> Hi - this macro should find "Invoice=" and then select from the previous page
> break to the following page break and delete. It's deleting multiple pages.
[quoted text clipped - 54 lines]
>
> End Sub
Julia - 03 Mar 2005 02:55 GMT
Doug - I figured it out, thank you so much!
> Hi - this macro should find "Invoice=" and then select from the previous page
> break to the following page break and delete. It's deleting multiple pages.
[quoted text clipped - 54 lines]
>
> End Sub