Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2005

Tip: Looking for answers? Try searching our database.

Delete Pages Using VBA in Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rxs0569 - 10 Nov 2005 03:06 GMT
He
I generate a long report. The first page is reserved for a template.

So for the next round I generate a report I would like to delete all
pages except the page on which the template table exists. How can I do
this.

Maybe a simple version to delete pages 2 to end of document

thanks
Raj
Jonathan Sachs - 10 Nov 2005 04:46 GMT
>So for the next round I generate a report I would like to delete all
>pages except the page on which the template table exists. How can I do
>this.

Word does not make this easy, for good reason. What's a page, anyway?
You could change all your document's page breaks by selecting a
different printer without even touching the document itself.

You can get the number of the page on which a range ends with the
expression

    range.Information (wdActiveEndPageNumber)

To find the precise point where a page ends you must iterate or
perform a binary search.

If I were in your position, I would conclude that Word was telling me
not to do what I was trying to do. Perhaps it would be better to
delete everything except the first table in your document, or the
first section. Perhaps it would be wise to modify the structure of the
document, if necessary, so that one of those approaches will do what
you want.

My email address is LLM041103 at earthlink dot net.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.