How can I find Page number of current selection in VB Word2002

A

AndyE92

I have coded a module that finds a selection within a document. How can I
find the page number of the page on which it resides from within my code?
 
J

Jay Freedman

Either

Selection.Information(wdActiveEndPageNumber)

or

Selection.Information(wdActiveEndAdjustedPageNumber)

depending on whether you want the "physical" or the "logical" page number,
respectively -- they can be different if page numbering is restarted in any
section of the document. Look in the VBA help topic for the Information
property.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
A

AndyE92

Thanks Jay. Spot on!

Jay Freedman said:
Either

Selection.Information(wdActiveEndPageNumber)

or

Selection.Information(wdActiveEndAdjustedPageNumber)

depending on whether you want the "physical" or the "logical" page number,
respectively -- they can be different if page numbering is restarted in any
section of the document. Look in the VBA help topic for the Information
property.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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