View Single Post
 
Old 06-21-2019, 06:28 AM
chrscote chrscote is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Aug 2016
Posts: 12
chrscote is on a distinguished road
Exclamation Want to remove first 2 blank pages

I have a script in DOORS that creates a document with a table. However, for some reason, it always adds 2 empty pages before the actual content. I have been trying to write a simple script that will delete these first 2 pages, but it's not working. Here's the code I'm using:
Code:
Sub removeExtraPages()
    Dim Rng As Range, iPage As Long
    iPage = 2
    With ActiveDocument
        Set Rng = .GoTo(What:=wdGoToPage, Name:=iPage)
        Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\page")
        Rng.Delete
    End With
End Sub

I found this code from this forum, but can't seem to figure out what is causing the problem. I'm hoping someone can help me out.


Chris
Reply With Quote