PDA

View Full Version : Solved: When mail merge word 2003 how do I delete an empty field



Victor
06-17-2009, 09:09 AM
If I can have an if that prevent an empty space between title and last name, that solve my problem.

«Title» «LastName»
The only way as I see it, is delete the space between title and last name but then it appears as:

MrDoe
Green (no space in this case)

I think there is no way no eliminate the space.

Thanks all for the help.

Victor

macropod
06-17-2009, 03:45 PM
Hi Victor,

In Word:
. make two copies of your «Title» field ahead of your «LastName» field;
. select both «Title» fields and press Ctrl-F9 to enclose them in a new field, thus {«Title»«Title»};
. fill in around the new field braces thus, paying careful attention to the spacing {IF«Title»= "" "" "«Title» "};
. position the cursor anywhere in this field and press F9 to update it;
. run your mailmerge.

Victor
06-18-2009, 03:20 PM
Macropod;

Its amazing how it works. Only doing your first suggestion below, make it works:

"make two copies of your «Title» field ahead of your «LastName» field;
. select both «Title» fields and press Ctrl-F9 to enclose them in a new field, thus {«Title»«Title»};"

Final code:

{{«Title»«Title»}}{«Title»}{«LastNname»} - no space between Title and LastName.


My question:

{{«Title»«Title»}} - How I undestand how this works?

Any ideas why this works without the IF? Or I am doing something wrong.

Thanks for the help.

Victor

macropod
06-18-2009, 03:53 PM
Hi Victor,

I would be surprised if your final code works - you need to code it as described. Your final code should look like:
{IF«Title»= "" "" "«Title» "}«LastName»
What the IF field does is to test the contents of the «Title» field. If the «Title» field is empty, it outputs nothing; otherise it outputs both the «Title» field and the space between it and the «LastName» field.

Victor
06-19-2009, 11:58 AM
macropod:

I typed the IF as sugested but:

When run the merge always appears a space in front of last name if there is no title.


I am uploading 2 attachments for your review and comment if possible:

TitleName.xls 3 records

TitleNameLetter.doc for merge records

Please let me know if there is something wrong or the space cannot be remove with the IF.

Thanks for your help.

Victor


PD The other file (TitleName.xls) is in the next reply since I can only send only one at a time.

Victor
06-19-2009, 12:04 PM
macropod:

Uploading second attachment (TitleLastName.xls).

Thanks for the help.

Victor

macropod
06-19-2009, 03:31 PM
Hi Victor,

If you open your mailmerge document and press Alt-F9 to reveal the field coding, you'll see:
{if { MERGEFIELD "Title" }=""""{ MERGEFIELD "Title" } } { MERGEFIELD "LastName" }
This is equivalent to:
{if «Title»=""""«Title» } «LastName»
and is not the same as the field code I posted. If you edit your existing field code, so that you end up with:
{if{ MERGEFIELD "Title" }= "" "" "{ MERGEFIELD "Title" } "}{ MERGEFIELD "LastName" }
it will work.

Victor
06-23-2009, 04:09 AM
macropod:

Now I finally got it working with your help and patience.

I should payed careful attention to the spacing since the first time.

My letter looks more professional, thanks to your help.

Great.

Victor