Consulting

Results 1 to 3 of 3

Thread: Determine Current Page Number

  1. #1
    VBAX Regular Sandieslover's Avatar
    Joined
    Sep 2004
    Location
    Netherlands
    Posts
    14
    Location

    Determine Current Page Number

    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

  2. #2
    BoardCoder VBAX Regular
    Joined
    May 2004
    Location
    Istanbul, Turkiye
    Posts
    73
    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

  3. #3
    VBAX Regular Sandieslover's Avatar
    Joined
    Sep 2004
    Location
    Netherlands
    Posts
    14
    Location

    Thumbs up

    Thanx a lot.
    I've searche about a day and a half but never found the .information. part in the help file.

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

    Thanx,
    Sandieslover

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •