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!

Re: find current page number by erin

erin
Fri Feb 10 10:39:55 CST 2006

Hello,
There is a good reference doc at
http://word.mvps.org/FAQs/MacrosVBA/index.htm
under the "returning information" section there is some info on finding
the page number called "Determine the page number at the current
cursor position"

Hopefully this can help you.


Re: find current page number by Jean-Guy

Jean-Guy
Fri Feb 10 11:02:48 CST 2006

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
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org



Re: find current page number by abbarition

abbarition
Tue Feb 21 10:37:20 CST 2006

This will work great. Thanks so much!

"erin.sebastian@cowaninsurancegroup.com" wrote:

> Hello,
> There is a good reference doc at
> http://word.mvps.org/FAQs/MacrosVBA/index.htm
> under the "returning information" section there is some info on finding
> the page number called "Determine the page number at the current
> cursor position"
>
> Hopefully this can help you.
>
>

Re: find current page number by abbarition

abbarition
Tue Feb 21 10:37:31 CST 2006

This will work great. Thanks so much!

"Jean-Guy Marcil" wrote:

> 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
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>
>
>