excelms-wordmailmergemailing

Automatic Replace Rule for Word?


I have a Word document which I use for Mailings and it is linked to an Excel file.

Lets say that this Excel file contains a Code (FA139, FA140, etc.) and I would like that the Word Document replaces the code with a string of text every time within the mailing feature. This means, that when I click next, it shall get the code from the Excel File and replace it with the text.

It is not purpose of the question to modify the excel file, but do all necessary changes (if possible) in the Word file.


Solution

  • All you need is a series of fields in Word coded along the lines of:

    {IF{MERGEFIELD Code}= "FA139" "Green"}{IF{MERGEFIELD Code}= "FA140" "Blue"}

    or:

    {IF«Code»= "FA139" "Green"}{IF«Code»= "FA140" "Blue"}

    where 'Code' is the field name.

    Note: The field brace pairs (i.e. '{ }') for the above example 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 practical to add them via any of the standard Word dialogues. Likewise, the chevrons (i.e. '« »') are part of the actual mergefields - which you can insert from the 'Insert Merge Field' dropdown (i.e. you can't type or copy & paste them from this message, either). The spaces represented in the field constructions are all required.