Word Help: Spacing in a Merge Document

melissakate

New Member
Joined
Mar 29, 2017
Messages
3
Hello,

I've been struggling with formatting a nametag word merge document. Can you help? Here's a condensed version of my merge doc:

{ if {MERGEFIELD "Nickname"} = "" {MERGEFIELD "FirstName"} {MERGEFIELD "Nickname"}} {MERGEFIELD LastName}
{If {MERGEFIELD "Child1Nickname"}="" {MERGEFIELD "Child1FirstName"} {MERGEFIELD "Child1Nickname"}} {MERGEFIELD Child1LastName}
{If {MERGEFIELD "Child2Nickname"}="" {MERGEFIELD "Child2FirstName"} {MERGEFIELD "Child2Nickname"}} {MERGEFIELD Child2LastName}
{If {MERGEFIELD "VolunteerRollEndDate"}="" {MERGEFIELD "VolunteerRoll}

{If {MERGEFIELD "VolunteerRoll2EndDate"}="" {MERGEFIELD "VolunteerRoll2}

So I get something like:

Matt Smith
Elyse Smith

Trustee
Class Agent

My question is: Is there a way to get rid of the blank lines? I've got multiple kids and multiple volunteer rolls - so with all the line breaks my data ends up "below" the margin on my nametag template. Any direction would be greatly appreciated!

 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
For each of:
{MERGEFIELD Child1LastName}
{MERGEFIELD Child2LastName}
you could add a \b "" switch and an \f "" switch, thus:
{MERGEFIELD Child1LastName \b " " \f ""}
{MERGEFIELD Child2LastName \b " " \f ""}
then drag the trailing paragraph breaks into each field, so you end up with:
{MERGEFIELD Child1LastName \b " " \f "¶
"}
{MERGEFIELD Child2LastName \b " " \f "¶
"}
Delete the spaces preceding these fields as well.

For the two fields:
{If{MERGEFIELD VolunteerRollEndDate}= "" {MERGEFIELD VolunteerRoll}}
{If{MERGEFIELD VolunteerRoll2EndDate}= "" {MERGEFIELD VolunteerRoll2}}
edit those so you have:
{If{MERGEFIELD VolunteerRollEndDate}= "" "{MERGEFIELD VolunteerRoll}"}
{If{MERGEFIELD VolunteerRoll2EndDate}= "" "{MERGEFIELD VolunteerRoll2}"}
then drag the trailing paragraph break into the field, so you end up with:
{If{MERGEFIELD VolunteerRollEndDate}= "" "{MERGEFIELD VolunteerRoll}¶
"}{If{MERGEFIELD VolunteerRoll2EndDate}= "" "{MERGEFIELD VolunteerRoll2}¶
"}

When done, you field coding should look like:
{if{MERGEFIELD Nickname}= "" {MERGEFIELD FirstName} {MERGEFIELD Nickname}} {MERGEFIELD LastName}{If {MERGEFIELD Child1Nickname}= "" {MERGEFIELD Child1FirstName} {MERGEFIELD Child1Nickname}}{MERGEFIELD Child1LastName \b " " \f "¶
"}{If{MERGEFIELD Child2Nickname}= "" {MERGEFIELD Child2FirstName} {MERGEFIELD Child2Nickname}}{MERGEFIELD Child1LastName \b " " \f "¶
"}{If{MERGEFIELD VolunteerRollEndDate}= "" "{MERGEFIELD VolunteerRoll}¶
"}{If{MERGEFIELD VolunteerRoll2EndDate}= "" "{MERGEFIELD VolunteerRoll2}¶
"}

Note: I've eliminated as many double-quotes and spaces as can be done and still have the field codes work. Your posted representation had some unbalanced double-quotes and field braces, plus some required spaces were missing.
 
Last edited:
Upvote 0
Thanks so much for your reply Paul. Is there a trick with the ¶ when I set it up with your hints nothing different happens. :confused:

Years ago, many versions of Word ago - I thought I was MUCH better at this.
 
Upvote 0
I just noticed a typo regarding the two fields:
{If{MERGEFIELD VolunteerRollEndDate}= "" {MERGEFIELD VolunteerRoll}}
{If{MERGEFIELD VolunteerRoll2EndDate}= "" {MERGEFIELD VolunteerRoll2}}
I said there to drag the preceding paragraph break into the field, but it should have referenced the trailing paragraph break.

That said, you may not notice any difference if you're only previewing the merge - you need to execute it to see the effect.
 
Upvote 0

Forum statistics

Threads
1,223,794
Messages
6,174,643
Members
452,575
Latest member
Fstick546

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top