View Single Post
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
 
Posts: n/a
Default Conditionally print outlook company in mail merge

As long as the comparison does what you need, it's then up to you what you
put in the "results", e.g.

{ IF "{ MERGEFIELD "Mailing_Address" }" = "{ MERGEFIELD
"Business_Address" }"
"{ MERGEFIELD "Company" }
{ MERGEFIELD "Mailing_Address" }"
"{ Mergefield "Mailing_Address_Street" }
whatever else you need" }

or whatever. If you want to suppress blank lines that occur as a result of
the IF field, in Word 2002/2003 you have do a bit more - ask if that's what
you need, or search this newsgroup as this question comes up quite
frequently.

Peter Jamieson


"Stukmeister" wrote in message
...
This works fine except that I also don't want to print the "Company" line
of
the address if the mailing address and business address are not the same.
The
way it is now, it prints a blank line in the address.

"Peter Jamieson" wrote:

First, to do this, you must be using the individual address fields, not
the
ADDRESSBLOCK field.

Then, to do what you said, you need something like

{ IF "{ MERGEFIELD "Mailing_Address" }" = "{ MERGEFIELD
"Business_Address" }" "{ MERGEFIELD "Business_Address_Street" } "" }

but I wonder if you actually need:

{ IF "{ MERGEFIELD "Mailing_Address" }" = "{ MERGEFIELD
"Business_Address" }" "{ MERGEFIELD "Company" } "" }

To insert these nested fields, use ctrl-F9 to insert the pairs of special
field braces {}, and type everything else in between. There are other
ways
to do it, but I think that's the most straightforward.

To do either of those, you will probably need to initiate your merge from
Outlook, because you may not get the same fields if you connect using the
Outlook Contacts option in the Word Merge Wizard.

Peter Jamieson


"Stukmeister" wrote in message
...
I am using MS Outlook Contacts with MS Word to mail merge envelopes. I
need
to print the Company name line if the "Mailing Address" is a business
address. If the "Mailing Address" is a home address, I don't want to
print
the Company name line.

A potential programatic solution would be: If MailingAddress =
BusinessAddress then print Company address line, else don't print
Company
address line. I just don't know how to code it in Word.

Anyone know how to solve this?