Hay All,
I'm trying to remove the last page of a word2000 document. (may also be last section). The document (template) holds paragraphs at the end of the document that are used by a macro to construct letters. When the macro finishes, I want to remove those paragraphs.
Found this routine but it only removes the first character of the page.
Thanks for any help...
Here's the code..
Sub DeletePage()
Dim rng1 As Range
Dim lStart As Long
Const pageNo = 3
Set rng1 = ActiveDocument.GoTo(wdGoToPage,wdGoToAbsolute, pageNo)
lStart = rng1.Start
Set rng1 = ActiveDocument.GoTo(wdGoToPage, wdGoToNext, pageNo)
rng1.Start = lStart
rng1.Delete
End Sub
I'm trying to remove the last page of a word2000 document. (may also be last section). The document (template) holds paragraphs at the end of the document that are used by a macro to construct letters. When the macro finishes, I want to remove those paragraphs.
Found this routine but it only removes the first character of the page.
Thanks for any help...
Here's the code..
Sub DeletePage()
Dim rng1 As Range
Dim lStart As Long
Const pageNo = 3
Set rng1 = ActiveDocument.GoTo(wdGoToPage,wdGoToAbsolute, pageNo)
lStart = rng1.Start
Set rng1 = ActiveDocument.GoTo(wdGoToPage, wdGoToNext, pageNo)
rng1.Start = lStart
rng1.Delete
End Sub