How do I programatically delete a page in word...

rsewell

Registered User.
Local time
Today, 18:45
Joined
Jun 4, 2003
Messages
12
Sounds like a silly question... I know. Basically, if a value in my Access database is less than 2, I need to delete the second page of a word document and then save and print it. It should look something like this:

If x < 2 then

objWord.ActiveDocument.DeleteSecondPage

end if

objWord.ActiveDocument.PrintOut (acPrintAll)
objWord.ActiveDocument.SaveAs....

Nothing complicated, I just can't figure out the commands. Any help would be greatly appreciated.
 
This should get you on your way to your answer.

1. Create a bookmark that encompasses everything on the second page. Name it "SecondPage".
2. To delete it, use this code:
objWord.ActiveDocument.Bookmarks("SecondPage").Range.Delete

HTH,
Jeff
 
WORKS GREAT!

That was so simple and it works perfect.

Thanks!
 

Users who are viewing this thread

Back
Top Bottom