As long as your spouse names always conform to certain rules, i.e.
a. one name means you have your type (2) situation (i.e. no forenames such
as Anne Marie, only Ann-Marie)
b. more than one name separated by spaces means you have your type (3)
c. the names are in an alphabet where there's an uppercase and lowercase
version of each letter
then you could try
{ MERGEFIELD first } { IF "{ MERGEFIELD spouse }" = ""
"{ MERGEFIELD last }"
"{ IF { QUOTE { MERGEFIELD spouse \*lower } \*firstcap }
= { QUOTE { MERGEFIELD spouse \*lower } \*caps }
"and { MERGEFIELD spouse } { MERGEFIELD last }"
"{ MERGEFIELD last } and { MERGEFIELD spouse }" }" }
If the names in the spouse field in the data source always have the first
letter of each name in upper case and the rest in lower case, you could
simplify that a bit to
{ MERGEFIELD first } { IF "{ MERGEFIELD spouse }" = ""
"{ MERGEFIELD last }"
"{ IF { QUOTE { MERGEFIELD spouse \*lower } \*firstcap } = { MERGEFIELD
spouse }
"and { MERGEFIELD spouse } { MERGEFIELD last }"
"{ MERGEFIELD last } and { MERGEFIELD spouse }" }" }
If things are not that consistent, you may need to consider creating the
data source you need (not easy in this case) or using Word VBA (probably
with Word's Mailmerge Events) to process the data in some way.
--
Peter Jamieson - Word MVP
Mike S said:
In our Outlook 2003 data we have three different name formats, the data is in the following fields.
1. John Doe: first= John, last= Doe
2. John and Mary Doe: first= John, Spouse= Mary, Last= Doe
3. John Doe and Mary Smith: first= John, last= Doe, spouse= Mary Smith
We are trying to figure out how to construct a merge field so letters and
envelopes will print all these names correctly ie: