Computer geek, and self-appointed know-it-all, Westley Annis answers all those hard 
questions about anything related to computers and technology, as well as business and 
political questions.

What page am I on?

Question asked on August 16, 2005 11:08 PM :: :: Comments (0) :: TrackBacks (1)

Unless you live and breathe the Microsoft Word object model, it can be difficult at times to figure out where to find the values you are looking for. Word is composed of a lot of different objects, each of which have different properties, although those properties may be repeated among some objects.

In this case you are looking for page numbers. These can be found using the Information property. You supply a Word constant that specifies the type of information you want returned. In this case, you have two options that jump right out: wdActiveEndPageNumber and wdActiveEndAdjustedPageNumber.

The first option will return the actual page number, ignoring any manual adjustments to the page numbers. The first page is page one even if it prints out as page 16. The latter option will adjust the page count based on your changes. So if you've specified that the first page will print as page 16, that is the number that is returned. The second page would be 17 and so on.

Exactly how do you use the Information property?

To get the page number for the current selection:

intCurrentPage = Selection.Information(wdActiveEndPageNumber)

To get the page number for a Bookmark:

intCurrentPage = Activedocument.Bookmarks(1).Range.Information(wdActiveEndPageNumber)

There is so much more available from the Information property. You can easily tell if the current selection is inside of a table, the column and row when the selection is inside a table, header and footer type, Overtype mode, NumLock status, and more.

Categories

1 TrackBacks

Listed below are links to blogs that reference this entry: What page am I on?.

TrackBack URL for this entry: http://www.askwestley.com/cgi-sys/cgiwrap/wannis/managed-mt/mt-tb.cgi/12

» AdultFriendFinder from AdultFriendFinder

I really enjoyed your topic and plan to share your blog with my friends! thanks for taking the time out to write your blog! If you want to learn how to get 100% free access to Adult Friend Finder check out my blog! Read More

Leave a comment




Ask Westley your question on technology, business, or politics!
RDF XML
Add to My Yahoo!
Subscribe in 
NewsGator Online
Feedburner
GeoURL
Search



All Categories
Powered by
Movable Type 4.1
© 2005-2009 by Westley Annis. All Rights Reserved.

Valid XHTML 1.0!