locked
footers in a Word document containing If logic does'nt work when there are merg fields in the document RRS feed

  • Question

  • Someone who prepares Custom docs can probably answer this question, but I can't
    figure it out.

    Objective: To print "Initials _________" in all footers
    but the last page.
    What I've used in the footer:
    {IF {PAGE} = {NUMPAGES}
    "" "Initials ___________"} using Ctrl F9 for the Curley brackets of
    course.
    The letter has three pages and the function works perfectly leaving
    the last page footer blank if there are NO merge fields in the body of the
    letter. When I add a merge field to the body of the letter, the phrase "Initials
    ________" prints on the last page in the footer when it should print nothing
    according tot the above If function.

    The {PAGE} and {NUMPAGES} variables
    are both equal to 3 on the last page.
    Doesn't appear that the if function is
    working properly when a merge field is added to the body of the letter.
    Not
    making any sense to me.
    Any thoughts would be appreciated.
    Monday, February 3, 2014 2:29 PM

Answers

  • It's a simple maths formula, with the output controlled via a numeric picture switch. To display the content on all pages except the last, use:

    {={NUMPAGES}-{PAGE} \# "'Initials _________';;"}

    In the picture switch, the ';' character separates the positive, hegative and zero (i.e. +ve;-ve;0) results so they can be displayed in different ways. Omitting a parameter from the switch results in a blank output for that parameter.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    • Marked as answer by BilleV Tuesday, February 4, 2014 4:29 AM
    Tuesday, February 4, 2014 3:46 AM

All replies

  • Try using SECTIONPAGES instead of NUMPAGES.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Monday, February 3, 2014 2:57 PM
  • both sectionpages and numpages produce the correct numbers in the footers but when used in the IF function in a Calyx Custom Document it misbehaves.  I'm thinking that this is a Calyx Custom Document problem.

    Bill Voorhees

    Monday, February 3, 2014 8:52 PM
  • I'm afraid I can't help you with that, sorry.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Monday, February 3, 2014 8:56 PM
  • Thank you for trying however.

    Bill Voorhees

    Monday, February 3, 2014 9:42 PM
  • To achieve what you're after, use a field coded as:

    {={NUMPAGES}-{PAGE} \# ";;'Initials _________'"}


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Tuesday, February 4, 2014 3:10 AM
  • Paul, this is getting closer.  It Prints 'Initials _______' on the last page and no others.  I need it to print on all pages except the last page.  Please explain what your formula is doing.

    Thanks for your assistance.


    Bill Voorhees

    Tuesday, February 4, 2014 3:38 AM
  • It's a simple maths formula, with the output controlled via a numeric picture switch. To display the content on all pages except the last, use:

    {={NUMPAGES}-{PAGE} \# "'Initials _________';;"}

    In the picture switch, the ';' character separates the positive, hegative and zero (i.e. +ve;-ve;0) results so they can be displayed in different ways. Omitting a parameter from the switch results in a blank output for that parameter.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    • Marked as answer by BilleV Tuesday, February 4, 2014 4:29 AM
    Tuesday, February 4, 2014 3:46 AM
  • Works perfectly.  Not sure why Calyx stutters on the logic I used above when I have Merge fields in the body of the document, but as Hillary says, "what difference does it make".  Your solution works.  Thankyou

    Bill Voorhees

    Tuesday, February 4, 2014 4:32 AM
  • Not sure why Calyx stutters on the logic I used above when I have Merge fields in the body of the document
    It's not really anything to do with Calyx, but with how mailmerges work. The issue you were having is that the IF field was being to the text of its result on the first page. That's something that happens to all IF fields - even IF fields containing mergefields in the header. The formula field, though, doesn't get converted - if you press Alt-F9 after doing your processing, you'll see the field code is still there; not so with the IF field.

    Cheers
    Paul Edstein
    [MS MVP - Word]

    Tuesday, February 4, 2014 5:25 AM