0

I'm trying to automatically generate Word documents. The necessary data is entering Word through custom document properties, coming from a third party program. Now I'd need to use conditionals on that data (e.g. if property X contains value Y, print string Z here, else string A).

I've been trying to do that using the conditional features of the mail merge feature[1], but I can't get it to work. Is there anyone who has succeeded here? VBA is unfortunately impossible due to constraints of the environment.

[1]: using Word's "magic braces" ``` { IF { DOCPROPERTY Myname } = "val" "output value if true" "output value if false" }

1
  • You have the right syntax. What happens if you click on this field (with field results showing rather than field codes) and press F9 (Fn+F9 on many computers)? Commented Aug 5, 2021 at 12:32

1 Answer 1

1

After inserting《Myname》Merge Field, select it and press Alt+F9, and then press Ctrl+F9 to add {} for {MERGEFIELD Myname}, as shown below.
Please note that the {} symbol must be added by pressing Ctrl+ F9.

enter image description here

Then select all Merge Fields and press Alt+F9, then F9 to preview results.
You could also refer to the method in Field codes: IF field.

On some computers anytime you use a function key you need to also press the Fn key.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .