Word IF Then Else Rule (Mail Merge) Insert Fields
Previously in the article Word IF Then Else Rule (Mail Merge) I’ve explained how you can use the If Then Rule in Mail Merge. In that article the If Then Else Field would insert a text string based on the result of the comparison.
In this article I will explain how you can insert Field Values rather than Text Strings using the If Then Else Rule.
Contents
Example:
Assume you are sending letters to 100 recipients. In the Recipient List created for the recipients, there is an Age Field. What we want to do, is to compare the Age Field with the value 18.
- If the recipients is older than 18 years, then we want the Age to be displayed
- But if the recipient is younger than 18 years, we want the Text String “Under 18′ to display.
This will be the letter sent out to a 25 year old:
and this will be a letter sent out to a 14 year old:
Step 1:
Follow the same steps explained in the article Word IF Then Else Rule (Mail Merge).
Step 2:
After completing step 1, press Alt+F9. This is what you will see:
The top part is the Greeting Line Field (which is irrelevant to our discussion):
Under that line you will see this:
This is the If Then Else Field:
{ IF { MERGEFIELD Age } > 18 "Over 18" "Under 18" }
The If Then Else Field:
As you can see the If Then Else Field has 3 parts:
If Statement:
This part compares the Age Field with the value 18:
IF { MERGEFIELD Age } > 18
Result If True:
This is what will be displayed if the If Statement returns True:
"Over 18"
Result If False:
This is what will be displayed if the If Statement returns False:
"Under 18"
What we need to do is to change the Result If True value to { MERGEFIELD Age }
:
{ IF { MERGEFIELD Age } > 18 { MERGEFIELD Age } "Under 18" }
By doing this, when the result of the If Statement is true, the Age of the recipient will be displayed.
Step 3:
As explained in the previous section we need to replace the text "Over 18"
with the Age Field. In order to do this select and delete the text "Over 18"
:
While the cursor is still in that location insert the Age Field:
Press Alt+F9 to return the normal view:
You can download the sample file used in this article from the link below:
See also:
If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website www.software-solutions-online.com
One thought on “Word IF Then Else Rule (Mail Merge) Insert Fields”