Word MailMerge IF statement not working with hyphens

M

mroshaw

Hi!

First up, I'm using Microsoft Word 2003 (11.6359.6360 SP1) on Windows XP
Professional SP2.

I have an external data source which supplies a field to a Word Mail Merge
template, detailing how a Customer made contact. The field can have the
following values:

Call - Inbound
Email - Inbound
Internet
Fax

If have a block of code to personalise the greeting:

Thank you for contacting us { IF { MERGEFIELD "CONTACT_TYPE" "Internet" "via
our website." } IF { { MERGEFIELD "CONTACT_TYPE" = "Call - Inbound" "via
telephone." } IF { { MERGEFIELD "CONTACT_TYPE" = "Fax" "via fax." "" } } }

This works fine for 'Internet' and 'Fax' but not for 'Call - Inbound' or
'Email - Inbound'. I suspect the issue is with comparing the hyphen, but I
can't figure out how to resolve this. I've turned off Autocorrection and
pasted the value directly from the data source into the Word document but
still no luck. I can display the field value on it's own without any issue.

Any ideas?

Many thanks for any responses!
 
D

Doug Robbins - Word MVP

That should be

Thank you for contacting us { IF { MERGEFIELD "CONTACT_TYPE" } = "Internet"
"via
our website." ""}{ IF { MERGEFIELD "CONTACT_TYPE" }= "Call - Inbound" "via
telephone." ""}{ IF { MERGEFIELD "CONTACT_TYPE" } = "Fax" "via fax." "" }{
IF { MERGEFIELD "CONTACT_TYPE" } = "Email - Inbound" "via Email." "" }

or it could be nested.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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