Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2003
    Location
    San Francisco, California, USA
    Posts
    88
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Sections Page Count (Word 2000)

    Is there any method of obtaining the total page count in a section through code? I know I can do it by inserting a field in the header or footer for SECTIONPAGES, but can't find a method by code directly.

    Thank you.

    Kyle

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Brussels, Brussel, Belgium
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sections Page Count (Word 2000)

    hi Kyle,

    the following seems to work for me.

    Function NumberOfPagesInSection _
    ( _
    ByRef CurrentSection As Section _
    ) As Long
    Dim StartSectionPage As Long
    Dim EndSectionPage As Long
    With CurrentSection
    EndSectionPage = _
    .Parent.Range _
    ( _
    .Range.End - 1, _
    .Range.End _
    ).Information(wdActiveEndPageNumber)
    StartSectionPage = _
    .Parent.Range _
    ( _
    .Range.Start, _
    .Range.Start _
    ).Information(wdActiveEndPageNumber)
    End With
    NumberOfPagesInSection = _
    EndSectionPage - StartSectionPage + 1
    End Function

    you can call the function for instance as follows:
    msgbox NumberOfPagesInSection(activedocument.Sections(3))

    greetings,

  4. #3
    Star Lounger
    Join Date
    Jan 2003
    Location
    San Francisco, California, USA
    Posts
    88
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Sections Page Count (Word 2000)

    Hi Pieter.

    Thanks so much. It worked but I did have to remove the increase of 1 to the subtraction of the starting and ending page number of the page range. I'm not sure why because it does make sense that it should be increased by one. I could not get an accurate page count with the +1.

    Kyle

Posting Permissions

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