View Single Post
 
Old 10-16-2015, 12:03 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,367
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

As was said previously, all the variable content could be handled via field coding within the document. For example, if you have a column named 'Code' with the codes as per post #5, you could use a single field coded as:
{IF{MERGEFIELD Code}= "D1" "Letter body for Damaged Consumer Use"}
or:
{IF«Code»= "D1" "Letter body for Damaged Consumer Use"}
to output all the text for the 'Damaged Consumer Use' letter.

Simply stringing these together, as in:
{IF{MERGEFIELD Code}= "D1" "Letter body for Damaged Consumer Use"}{IF{MERGEFIELD Code}= "D2" "Letter body for Damaged Fixed"}{IF{MERGEFIELD Code}= "D3" "Letter body for Damaged Lab Report"}, etc.
or:
{IF«Code»= "D1" "Letter body for Damaged Consumer Use"}{IF«Code»= "D2" "Letter body for Damaged Fixed"}{IF«Code»= "D3" "Letter body for Damaged Lab Report"}, etc.
is all that would be required to generate all possible letters.

The conditional Letter Body output can include multiple paragraphs, more mergefields, tables, pictures, and so on. Similarly, mergefield field switches can be used to suppress text before and/or after a mergefield when that field is empty. Examples of that are shown in the Mailmerge Tips and Tricks 'Sticky' thread at the top of this forum: https://www.msofficeforums.com/mail-...ps-tricks.html


Note: The field brace pairs (i.e. '{ }') for the above examples are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practicable to add them via any of the standard Word dialogues. Likewise, you can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the 'Insert Merge Field' dropdown. The spaces represented in the field construction are all required.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote