How to get a range object for a certain page?

C

cym

I am building a Word application that would retrieve the text for a
certain page. How could I do it without using Selection object, but
with Range object? Ideally, I would like to get the Range object only
in the main text (The StoryRanges type would be wdMainTextStory).

Thanks for your help in advance!
cym
 
S

Stefan Blom

In Word, you really cannot work directly with pages. What you can do is make
use of a predefined bookmark to return the range object for the current
page:

Set r = ActiveDocument.Bookmarks("\Page").Range

For more on predefined bookmarks, see this KB article (which was written for
Word 2000, but it is relevant for newer versions as well):

WD2000: How to Use Built-in (Predefined) Bookmarks in Word
http://support.microsoft.com/kb/212555/en-us
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top