Consulting

Results 1 to 11 of 11

Thread: Solved: Is there an event to catch if a document goes over one page?

  1. #1
    Knowledge Base Approver
    Space Cadet
    VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location

    Cool Solved: Is there an event to catch if a document goes over one page?

    I was just wondering if there is an event that can be trapped that tells when a document has gone over into two or more pages?

    Basically I would liek to watch for the event and then format page number two to a different page setup/footer etc.

    Andrew;?
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Back to the page numbering nightmare, eh?
    I think this might be a problem though, because Word doesn't really "think" in terms of pages. In fact I've noticed when using fields for page numbers that until you do something that forces it to repaginate the doc (like printing) it will quite happily tell you all your 20 pages are all page 1 of 1 ?!
    I've always thought a Document_Change event would be a nice addition but no such luck.
    Sorry... I've been stumped on this before

    K :-)

  3. #3
    Knowledge Base Approver
    Space Cadet VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location
    ah well, it was worth a shot
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  4. #4
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Indeed it is. Mind you, I don't know if you should mark it as solved just yet. One of the Word specialists may know of a trick. That's the thing I find with Word VBA, you have to know all these wierd unintuative tricks to do seemingly obviuos things...
    K :-)

  5. #5
    Knowledge Base Approver
    Space Cadet VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location
    alright then. don't know how to unsolve a thread - probably an admin only option. And yeah - excel VBA what little I know of it is cool because its mathematical in feeling however word VBA is just plain stubborn.

    ------------------------------------------------------------------------------

    I think I won the battle but I'm not too sure about the war. I managed to bend the sections object to my will - sort of. I found it all has to do with sections. The software that creates the document inserts a superfluous coninous section break (this really annoyed me) till i figured out that i can set section1 as well as section 2's footers at the same time, even if there is only one page. So I setup up the document with this in mind. It works and now i just have to see if the field codes stay visible or not post insertion - I think its a template thing as I'm writing this code in a special global template that the merged doc will use. We'll see.



    Thanks again for the help killian

    Andrew;?
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  6. #6
    VBAX Regular
    Joined
    Aug 2004
    Location
    On a 100 acre hobby farm in beautiful west Quebec.
    Posts
    87
    Location
    This is a common practice for page one of a multi-page letter. Here's how I do it in my personal letter template:

    1. In Page Setup, Layout tab, turn on the different first page checkbox for headers and footers.

    2. Create a footer for the first page with only the following field (note that the braces need to be the ones Word puts in when you create a field with Ctrl-F9):
    { if { numpages } >1 /...2" "" }

    Now if the letter fits fully on one page, the condition is false so no footer shows up. However, if it flows over to a 2nd page, the condition is true so the /...2 appears at the bottom of page 1. If you use this in a template for letters, it will be there automatically for you.

    Note that if you adjust a letter to get it back to a single page, you may want to flip from Print Layout view to Normal view and back to "recalculate" the page footer.

    Tip: If you use the envelope feature to add an envelope to the document, the envelope will be added as a new first section, making the letter >1 page. If you tend to use this feature, I'd suggest using the SectionPages field instead of numpages so the If condition only counts pages in the letter section.
    Eric

    Experience is not what happens to a man; it is what a man does with what happens to him. ? Aldous Huxley

  7. #7
    VBAX Mentor
    Joined
    Sep 2004
    Location
    Nashua, NH, USA
    Posts
    489
    Location
    Quote Originally Posted by sandam
    I was just wondering if there is an event that can be trapped that tells when a document has gone over into two or more pages?

    Basically I would liek to watch for the event and then format page number two to a different page setup/footer etc.

    Andrew;?
    you do not need an event.

    just create the necessary headers/footers in advance, using different 1st page headers/footers.

  8. #8
    Knowledge Base Approver
    Space Cadet VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location
    thats exactly what i've done :
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  9. #9
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    For anybody who wants to use this link in future (wish I'd seen this thread, doh!):

    www.vbaexpress.com/EE/ltrheadtmplt.doc
    ~Anne Troy

  10. #10
    Knowledge Base Approver
    Space Cadet VBAX Tutor sandam's Avatar
    Joined
    Jan 2005
    Location
    London
    Posts
    292
    Location
    Thanks dreamboat. My biggest problem is that post merge the document loses certain properties and I had to account for those. i wish it was as simple as just creating a header and footer. Dang nabbit 3rd part software! But the issue is definitely resolved now. All thats left is making everyone think like me so they don't break the macros
    Nothing annoys a non-conformist more than other non-conformists who refuse to conform to the rules of non-conformity.


    Confused is my normal state of mind


  11. #11
    Site Admin
    The Princess VBAX Guru Anne Troy's Avatar
    Joined
    May 2004
    Location
    Arlington Heights, IL
    Posts
    2,530
    Location
    Uh oh!
    Futile.
    I've been trying to get my husband to think like me for years.
    Futile.
    ~Anne Troy

Posting Permissions

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