Consulting

Results 1 to 3 of 3

Thread: Solved: Counting number of pages in word

  1. #1
    VBAX Tutor
    Joined
    Dec 2006
    Posts
    271
    Location

    Solved: Counting number of pages in word

    Hi all
    I have a project that builds a 2 column table on a word document from an excel spreadsheet adding images and some text to each row of the table.

    It builds the table by looping through a list on a spreadsheet

    The majority of the time all the info fits onto one page of the word doc, however sometimes it will spill over onto 2 pages

    Is there a way that during the loop routine it can identify when the word document will start a new page????

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    You would probably have more luck asking this in a Word forum.

    Have you thought about using Word's FitToPages?

    I don't do Word much but if the Word object names is wa then:
    [vba]MsgBox wa.ActiveDocument.ActiveWindow.ActivePane.Pages.Count[/vba]

  3. #3
    VBAX Tutor
    Joined
    Dec 2006
    Posts
    271
    Location

    Thanks

    Thanks Kenneth
    Thats worked great and has solved the problem I asked.
    But has given me another problem with headers and form fields which I will post in a new thread

    Thanks again

Posting Permissions

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