2

I want to use Document Properties that are passed down from a document content type from Sharepoint in IF-Statements in Word (Field Codes). The goal is to automate contract creation using a template and sharepoint data from a library.

Though within the template I want to have multiple IF-Fields to correctly change the content according to Gender etc.

My problem is that I can easily add the document properties using Quick Parts > Document Properties, but when I create a new Field code (CTRL-F9) and write:

{ IF { DOCPROPERTY Anrede } = "Herr" "männlich" "weiblich" }

it keeps returning "ERROR! Unknown document property name".

Whenever I just use Quick Parts, the information is always there and correct, so I am completely confused why it won't work with field codes.

UPDATE: So now I tried { Set Anrede "[Anrede]" } ([Anrede] being a Quick Part Document Property)

But when I try and REF it in an IF function, like:

{ IF { REF Anrede } = "Herr" "männlich" "weiblich" }

the result doesn't change when the input does..

Thanks in advance for any help!

I did not write the braces out by hand, but always used CTRL-F9

0

I know this was a while ago but I have managed to use what you have posted in order to solve this exact same issue for myself.

When using {Set Anrede "[Anrede]"} I managed to make it work by swapping that to {Set Andede } then going to Quick Parts > Document Property and then selecting the property, this then allowed me to set up the IF statement.

I hope this helps even now but thank you for pointing me in the right direction to fix my problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.