Mail Merge

N

Nick2112

Hi everyone!

I'm trying to set up a mail merge where my main document starts off
with the following code...

{ IF { MERGEFIELD Name } <> "" "{ MERGEFIELD Name }" "" } { IF {
MERGEFIELD Name } <> "" "
{ MERGEFIELD Company }" "{ MERGEFIELD Company }" }

Basically, if a record contains a name, the company should be placed at
the beginning of the next line. If a record doesn't contain a name,
the company should be placed at the beginning of the current line.

However, while the company is placed on the current line when there's
no name, it's not placed at the beginning. For some reason it's
indented.

I should mention that I have a left tab and hanging indent set at 1.5",
but as far as I understand these shouldn't affect the first line. The
first line should start at the beginning.

Am I missing something?

Thanks!
 
P

Peter Jamieson

It works OK here (but I'm using Word 2004).

In the code you've put in your message there is a space between the two {
IF } fields. Is that actually in your source or is it a transcription error?
Even a space should only make a one-space difference, but if it is actually
a tab, then the behaviour would be exactly as you describe.

Unless there is a good reason not to do it I'd probably do it all in on IF -
not that it makes any logical difference:

{ IF { MERGEFIELD Name } <> ""
"{ MERGEFIELD Name }
{ MERGEFIELD Company }"
"{ MERGEFIELD Company }" }

(you don't have to have the 1st and 3rd carriage returns, i.e.

{ IF { MERGEFIELD Name } <> "" "{ MERGEFIELD Name }
{ MERGEFIELD Company }" "{ MERGEFIELD Company }" }

is fine.

The only other obvious possibility is that the paragraph mark in your 2nd IF
introduces a paragraph with a different layout than you expect, but in the
scenario you describe that wouldn't happen anyway.

Peter Jamieson
 
N

Nick2112

Thanks Peter! After telling me that it works for you I took another
look and found the problem. I was looking at the formatting prior to
initiating the mail merge. The formatting for the merged document is
fine.

Peter said:
Unless there is a good reason not to do it I'd probably do it all in on IF -
not that it makes any logical difference:

{ IF { MERGEFIELD Name } <> ""
"{ MERGEFIELD Name }
{ MERGEFIELD Company }"
"{ MERGEFIELD Company }" }

I actually have the name split into first name and last name, and the
codes contains other field codes, such as Title and Suffix. Also, some
records have a first name but no last name, some don't have a name but
have a company, and other records have a company and no name.

Thanks again, Peter! I really appreciate your help!
 

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