Solved

Insert Conditional Paragraph in Word Merge Template

Posted on 2011-02-17
1
1,196 Views
Last Modified: 2012-05-11
Is there a way to insert a blank paragraph (or in otherwords a carriage return) in a word merge temlate that is based on one of the merge fields in the document's data source meating a certain condition?  For example, I have a letter template that contains a table near the bottom representing a CC block.  The block may contain 1, 2, or many names, each separated by a carriage return.  If the count of the names exceeds 7 then the remaining names print on the next page.  What I want instead is for the tempate to remove the paragraphs immediately above the CC table so all the names move up and the letter can still exist on one page.

Thanks in advance for your response.
0
Comment
Question by:SueJStevens
1 Comment
 
LVL 50

Accepted Solution

by:
teylyn earned 500 total points
ID: 34920345
Hello,

this would be easiest if your source data contained a field with a count of the names, for example ccCount. Then you can use the {IF} field in your merge like

{ IF {MERGEFIELD ccCount} > 7 "<insert page break here>{MERGEFIELD ccName1} ¶
{MERGEFIELD ccName2} ¶
{MERGEFIELD ccName3} ¶
{MERGEFIELD ccName4} ¶
{MERGEFIELD ccName5} ¶
{MERGEFIELD ccName6} ¶
{MERGEFIELD ccName7} ¶
{MERGEFIELD ccName8} ¶
{MERGEFIELD ccName9}" "{MERGEFIELD ccName1} ¶
{MERGEFIELD ccName2} ¶
{MERGEFIELD ccName3} ¶
{MERGEFIELD ccName4} ¶
{MERGEFIELD ccName5} ¶
{MERGEFIELD ccName6} ¶
{MERGEFIELD ccName7} ¶
{MERGEFIELD ccName8} ¶
{MERGEFIELD ccName9}" }

The EE comment is not the best way to write field codes. Please do not write the {} manually, but use Ctrl-F9 to insert a field, then write between the brackets. The {IF} syntax is

{ IF condition "do when true" "do when false" }

You can have fields within the "do when true" and "do when false" and you need to enclose the whole "do when true/false" with double quotes. Within the "do when true/false" you can have paragraph marks, page breaks, etc.

I'll be happy to arrange the fields in your document, if you send me the merge document with the field names in place. You can replace the text with dummy text. I really only need the part with the CC block.

cheers, teylyn
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now