Results 1 to 5 of 5
  1. #1
    sgerber
    Guest

    How many pages in document?

    I've got a hunch I'm going to feel like a total idiot when I read the answer to this, but since I can't find it anywhere...

    Is there a simple way for VBA to determine how many pages there are in a document?

  2. #2
    JustCallMeAl
    Guest

    Re: How many pages in document?

    <pre>intTotalPages = ActiveDocument.ComputeStatistics(wdStatisticPages) </pre>


  3. #3
    sgerber
    Guest

    Re: How many pages in document?

    That did it, Al.

    Thanks!

  4. #4
    JustCallMeAl
    Guest

    Re: How many pages in document?

    Here are a couple of more choices. The one I originally gave is the most reliable, but it is the slowest.

    <pre>Selection.Information(NumberOfPagesInDocument )

    ActiveDocument.BuiltInDocumentProperties("Number Of Pages")</pre>


    Good Luck

  5. #5
    Star Lounger
    Join Date
    Jan 2001
    Location
    U.S. - East Coast
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How many pages in document?

    Please see my post back in January (#5251) regarding ComputeStatistics. While it should be reliable for pages in a document, it is NOT reliable for count the number of lines in a range, so use it carefully.

Posting Permissions

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