Inserting additional documents using If Statements

J

Julie DeCandia

How do I include an additional page to the main merge document if certain conditions apply? I have constructed an if statement to say that if a condition is met to insert the additional page if not do nothing. But I keep getting an additional blank page added to each record that does not meet the condition.
ex:
{ IF "{MERGEFIELD AidID }" = "Scholarship" { INCLUDETEXT "C:\\mydocs\\scholarship.doc" \* MERGEFORMAT }" "" }
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?SnVsaWUgRGVDYW5kaWE=?=,
How do I include an additional page to the main merge document if certain conditions
apply? I have constructed an if statement to say that if a condition is met to insert
the additional page if not do nothing. But I keep getting an additional blank page added
to each record that does not meet the condition.
ex:
{ IF "{MERGEFIELD AidID }" = "Scholarship" { INCLUDETEXT "C:\\mydocs\\scholarship.doc" \* MERGEFORMAT }" "" }
Have you tested this by using "plain text" entries instead of the IncludeText field, just
to be sure it's not a problem with the true/false condition? Which version of Word are we
dealing with?

Note that one should usually turn this around:

{ IncludeText "C:\\mydocs\\scholarship.doc" { IF { mergefield AidID } = Scholarship
"BookmarkNameWithPage" "BookmarknameNoContent" } }

Word has a tendency to update fields from the inside out, which can give odd results with
IF fields under these circumstances.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :)
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?SnVsaWUgRGVDYW5kaWE=?=,
I have tested this with plain text entries. This is Word 2000 that I am using.

The thing is that I have 5 records that I am doing testing with. 3 of them have a
scholarship and 2 dont. When I do the merge the scholarship document is inserted
correctly with the 3 that have it and a blank page is inserted with the two that dont. I
am not using bookmarks as I need the whole document to be inserted. Do I need to use
bookmarks anyway? I did turn it around and do the includetext first but then it doesnt
work at all.Very difficult to say without seeing the field code you tested with, and knowing how the
documents being referenced in IncludeText are constructed. I'd say, if you want the result
for the "false" part to be small enough not to be noticed, you definitely need to use a
bookmark.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top