PDA

View Full Version : Solved: Determine Current Page Number



Sandieslover
09-23-2004, 04:51 AM
Hi,


what code do I have to use to determen the current pagenumber?
I've tried to use some code
Pagnr = wdPageNumber but for some reason this wdPageNumber is set to 7 and the code won't run beyond this page.

As I have to run a macro through all the documents pages, perhaps there is some otherway to stop the macro at the end of the last page.

Regards,
Sandieslover

smozgur
09-23-2004, 05:08 AM
Hi Sandieslover,

The current page number is :
Pagnr = Selection.Information(wdActiveEndPageNumber)

Total number of pages:
TotPages = ThisDocument.ComputeStatistics(wdStatisticPages)

FYI : wdPageNumber variable is a Word application constant to use as a parameter for functions and it is always 7 (just like wdStatisticPages = 2 and wdActiveEndPageNumber=3).

I hope it helps.
Suat

Sandieslover
09-23-2004, 05:22 AM
Thanx a lot. :kiss
I've searche about a day and a half :mkay but never found the .information. part in the help file.

I hope I can return the favour sometime in the future.

Thanx,
Sandieslover