Word fields - IF statement not working as expected due to quote/speech marks
Use the following:
{ IF {DOCVARIABLE variable1 } = "" "" "(the {QUOTE 34} {DOCVARIABLE variable2 }{QUOTE 34})" }
Remove the quotes surrounding variable1 and variable2
Always use Ctrl + F9
- Before starting the If
- Before writing DocVariable variable1
- Before writing DocVariable variable2
- Quote 34
Create the variable1 and 2 in Fields before Formula Run your VBA code to set values to the variable and Update Fields
Keep in mind if variable1 is string empty is ""
if variable1 is number null is 0
When using this {QUOTE 34} you need to use the F9 key to show the results. And if you are in a mail merge document, you might need to toggle the mail merge "Preview Results" ribbon action item.