View Single Post
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Laura_Christian Laura_Christian is offline
external usenet poster
 
Posts: 1
Default Supress text if merge field is null

Hi there,

I'm having a hard time figuring out how to use if/then field codes in Word
for a mail merge.

In my address block, for instance, I would like to include the text "ATTN: "
at the beginning of the contact line if and only if a contact person has been
named in the Excel spreadsheet that is my data source. If no contact person
has been named, then the line should be suppressed altogether.

I tried the following code, but it did not work:

{IF {MERGEFIELD Firstname} "" "ATTN: {MERGEFIELD Firstname} {MERGEFIELD
LastName}" ""}

What am doing wrong? And can one just spell out the MERGEFIELD name, or do
you have to insert it some other way?

I'm having similar problems with commas that need to be inserted in the
address block if and only if a state has been named in the Excel spreadsheet;
with international addresses, there is usually no state, and so there should
not be a comma after the city name.

Help!