Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Aug 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How can i detect if i am on the last page? (word 2000, word 97)

    Hi,

    I have a .doc file that has 5 bookmarks in the footer. Data needs to be displayed in Bookmarks 1-3 on all pages and bookmarks 4 and 5 ONLY on the last page. How can i detect if i am on the last page of the document?

    Thanks,
    Sue

  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: How can i detect if i am on the last page? (wo

    I agree with Andrew's statement about using an IF field. However, if you have bookmarks in the footer itself, they will always be shown on every page. What you would need to do is use REF fields that display the contents of bookmarks 4 & 5. You could use an ASK field to hold the contents of those bookmarks.

    i.e. You have 3 bookmarks in the footer.
    You have two ask fields in the footer. e.g. {ASK bmk4} & {ASK bmk5}, where bmk4 & 5 are the names of bookmarks 4 & 5. Each is followed by an IF field.

    So replace your fourth & fifth bookmarks in your footer with:
    { ASK bmk4 }{ IF { page } = { numpages } "{ REF bmk4 }" "" }
    { ASK bmk5 }{ IF { page } = { numpages } "{ REF bmk5 }" "" }

    where the curly brackets are inserted by pressing Ctrl+F9, not typed. NOTE: You will have to update the fields in your header to enter the text for bmk4 & 5. If you like, you could place the ask fields in the beginning of the document & then press Ctrl+A & then F9 to update those fields.

  3. #3
    5 Star Lounger
    Join Date
    Oct 2002
    Location
    Wellington, Wellington, New Zealand
    Posts
    621
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How can i detect if i am on the last page? (word 2000, word 97)

    (Edited by HansV to correct NUMPAGE to NUMPAGES.)

    I'm picking that this can be done by checking that the field "Page" is equal to the field "NumPages"

    This is an IF with fields - and, I'm not necessarily the world's expert on fields <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15> but of course Microsoft Help is <img src=/S/rofl.gif border=0 alt=rofl width=15 height=15>

    { IF { PAGE } = { NUMPAGES } "True" False" }

  4. #4
    New Lounger
    Join Date
    Aug 2004
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How can i detect if i am on the last page? (wo

    ok, maybe i dint explain it right .. my mistake [img]/forums/images/smilies/sad.gif[/img] I am trying to figure out this footer stuff from another document (VBA script). after i have printed all the information in the header and the main body of the document, i want to print the footer information(by replacing bookmarks). Now, all I want to do is find out docnew.total number of pages (if there is such a methos in vba). I couldnt find a method of this sort.. Please help..

    Thanks again..

  5. #5
    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: How can i detect if i am on the last page? (wo

    The .Information property (method?) of the Selection or the Range object will give you the page number for a particular Selection or Range.

    You could try this:
    <pre>With ActiveDocument.Content
    ' Physical count of pages
    intPhysPg = .Information(wdActiveEndPageNumber)
    ' Number user has assigned to the last page
    intLogPg = .Information(wdActiveEndAdjustedPageNumber)
    End With
    </pre>

    Hope this helps.

Posting Permissions

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