Thread: [Solved] Need help with Field Codes
View Single Post
 
Old 07-24-2015, 05:16 AM
Cosmo Cosmo is offline Windows Vista Office 2007
Competent Performer
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Cosmo: I note that you've posted your question in the mailmerge forum. If this is indeed for a mailmerge, you need to be aware that your field code won't work. For starters, it would need to appear more like:
{IF{PAGEREF CONT}>{={PAGE}+1} "page {PAGEREF CONT}" "the following page" }
Yes this is being used in a mail merge, but it may also be used in a standalone user-entered document.
Quote:
Originally Posted by macropod View Post
Even then, however, because IF fields get converted to their results immediately the merge for each record is executed, you'd only ever get the "the following page" output.
Thanks for the info, I was definitely not aware of this. Is the IF field converted before the merge or after? Currently, I have this field at the bottom of the first page, and the CONT bookmark will most likely appear on the second page, but I want to make sure it is flexible enough to handle if the data is longer than an extra page. I may have to put a similar field into the footer for the next section which will need to appear on each page except for the last page, so it sounds like I can't use an IF field for this. Is there a solution that would do this in a mail merge?
Quote:
Originally Posted by macropod View Post
Furthermore, since you can only have one instance of a given bookmark in a document, the bookmarks, too, get deleted. Consequently, all you're left with is field coding that can do something based on the number of pages in a Section. The following construction will do that and survive a mailmerge:
{={SECTIONPAGES}-{PAGE}-1 \# "'page {QUOTE{={PAGE}+2}}';;'the following page'"}
Note that you'll need to update the fields in the output document (e.g. via Ctrl-A, F9), post-merge, to get the correct text output.
Thanks, I will try this out to see if this does what I need. The bookmark will be the start of the next section

I appreciate all of the input.
Reply With Quote