Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2004
    Location
    Rochester, New York
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Total Pages of Multiple Sections (W2K SP4/WD2000)

    We are trying to set up a document with a cover page that summarizes the number of pages contained within sections of the document, sort of like a TOC, but not really. One functional section of the overall document actually has several Word sections; we would like to either retrieve the number of pages in certain sections, i.e. sections 3 through 6, or retrieve the number of pages in each section, i.e. section 1, section 2, etc., ad nauseum, you get the idea.

    I figure a macro that will run in conjunction with document printing would be appropriate.

    Please advise or contact me offline if you'd like more information.

    TIA.

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Total Pages of Multiple Sections (W2K SP4/WD2000)

    Welcome to the Lounge. One way to do this is to use the field:
    { SECTIONPAGES }
    in each section of the document. The curly brackets aren't typed; they're inserted by pressing Ctrl+F9. When placed in it's own section, it gives the number of pages in that section.

    After that, you would bookmark the field in each section & give it a name such as Section1NumPages, Section2NumPages. On your cover page, you could then use a formula field:

    {={ Section1Numpages }+{ Section2Numpages }+{ Section3Numpages }} etc. (making sure to use Ctrl+F9 to insert braces.)

    By the way, we like to keep all communication in the Lounge so that the questions & answers can benefit everyone.
    Hope this helps,

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Total Pages of Multiple Sections (W2K SP4/WD2000)

    I'm more partial to a macro solution myself.

    Each section has a .Range property, and from a Range you can use CalculateStatistics. Interestingly, the number of pages returned by this method appears to always be one page too high, as though the implicit page break at the end of the section (or at the beginning?) is being counted. So... to adjust for that... assuming that all of your section breaks imply page breaks... you could use this formula:

    ActiveDocument.Sections(SectionNumber).Range.ComputeStatistics(wdStatisticPages) - 1

    This would appear to be gibberish if you've never programmed VBA macros before. In that case we can fill in some of the missing pieces. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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