LEU said:
I know the following will delete the page I'm on in my document
except the last page. What do I need to do to it to delete the last
page? Also if the last page is a landscape page is there anything I
would have to do differently to keep the previous page from becoming
a landscape page?
Selection.Bookmarks("\Page").Range.Delete
Actually, that line might delete the last page; it depends on why the page
exists.
If there's text on the page and the Widows/Orphans feature is what forced it
there, but there's room for one empty paragraph mark on the preceding page,
then running the delete code will remove the last page.
If the page exists for most of the other possible reasons -- no room for the
undeletable last paragraph mark on the preceding page, a manual page break
or a Next Page section break, "Page Break Before" paragraph formatting,
etc. -- you have to find that reason and eliminate it. A good rundown of the
causes is at
http://sbarnhill.mvps.org/WordFAQs/BlankPage.htm.
If the last page is a landscape page and the preceding page is portrait,
there must be a section break between them. Dealing with that is a pain.
Read
http://www.word.mvps.org/FAQs/Formatting/WorkWithSections.htm, the part
headed "If you really want to delete the temporary section break".
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.