Share via

"Error! Unknown op code for conditional" on simple conditional mergefield

Anonymous
2011-05-13T22:36:46+00:00

I used this example **from the Microsoft Office website (**Examples of IF fields) as my starting point:

{ IF { MERGEFIELD State } = "NY" "{ INCLUDETEXT c:\worddocs\contract.doc }" "{ AUTOTEXT Copyright }" }

No matter what I do, I keep getting "Error! Unknown op code for conditional". As a test I used this statement exactly (creating c:\worddocs\contract.doc) and I still get the error. As recommended in other responses to others getting this error, I verified that I have spaces on either side of the =.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Paul Edstein 82,861 Reputation points Volunteer Moderator
2011-05-13T23:06:24+00:00

Hi twinkitties,

Are all the field brace pairs (ie '{ }') for the above example created via Ctrl-F9? You can't simply type them or copy & paste them from a website.

FWIW, the absolute minimum you need for the field code to work is:

{IF{MERGEFIELD State}= "NY" {INCLUDETEXT c:\worddocs\contract.doc} {AUTOTEXT Copyright}}

Also, if your document's path or name has spaces, you sould use at least:

{IF{MERGEFIELD State}= "NY" {INCLUDETEXT "c:\worddocs\contract.doc"} {AUTOTEXT Copyright}}

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2011-05-13T23:22:23+00:00

    Ctrl-F9 did it. Thank you SOOO much!

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments