find current page number

A

abbarition

I'm sure this is fairly simple, but for some reason I can't seem to find it.
Does anyone know the code to find the current page number?

This is what I am using it for: I have code that will run on exit of all
the fields on my word form. However, I need the code to vary slightly
depending on the page the field is on. If I can find the page number, I can
have the code run the necessary changes.

Thanks in advance!
 
J

Jean-Guy Marcil

abbarition was telling us:
abbarition nous racontait que :
I'm sure this is fairly simple, but for some reason I can't seem to
find it. Does anyone know the code to find the current page number?

This is what I am using it for: I have code that will run on exit of
all the fields on my word form. However, I need the code to vary
slightly depending on the page the field is on. If I can find the
page number, I can have the code run the necessary changes.

Thanks in advance!

Play around with these examples:

MsgBox Selection.Information(wdActiveEndPageNumber)
MsgBox Selection.Information(wdActiveEndAdjustedPageNumber)
MsgBox ActiveDocument.Fields(1).Result.Information(wdActiveEndPageNumber)

The first two will return the page number the currently selected text is on.
The third will return the page number for the first field in the document.

wdActiveEndAdjustedPageNumber returns the page number as displayed in the
status bar (which might not be the actual physical page number if you
restarted numbering at a new number in the current section) whereas
wdActiveEndPageNumber returns the physical page number according the count
of pages in the document.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
A

abbarition

This will work great. Thanks so much!

Jean-Guy Marcil said:
abbarition was telling us:
abbarition nous racontait que :


Play around with these examples:

MsgBox Selection.Information(wdActiveEndPageNumber)
MsgBox Selection.Information(wdActiveEndAdjustedPageNumber)
MsgBox ActiveDocument.Fields(1).Result.Information(wdActiveEndPageNumber)

The first two will return the page number the currently selected text is on.
The third will return the page number for the first field in the document.

wdActiveEndAdjustedPageNumber returns the page number as displayed in the
status bar (which might not be the actual physical page number if you
restarted numbering at a new number in the current section) whereas
wdActiveEndPageNumber returns the physical page number according the count
of pages in the document.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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