conditional text - if else

V

Vaughn

Can anyone give me a quick primer on setting up conditional text where;
if cond=true then xxx else yyyy
 
J

Jay Freedman

Vaughn said:
Can anyone give me a quick primer on setting up conditional text
where; if cond=true then xxx else yyyy

Hi Vaughn,

Word handles this with a field, and the syntax is fairly close to what you
wrote. You can choose an IF field in the Insert > Field dialog, or press
Ctrl+F9 to insert an empty set of field braces and write the code yourself.
Within the braces, the code should look like

IF cond "xxx" "yyy"

That is, you drop the =true part and the else, and put quotes around the
displayable text. The xxx will display if the condition is true, and the yyy
will display if the condition is false. You could also omit the "yyy" from
the code, and then the field will display nothing if the condition is false.

Some examples are in the last section of
http://word.mvps.org/FAQs/Numbering/PageNumbering.htm. A slightly more
advanced example can be seen at
http://word.mvps.org/FAQs/TblsFldsFms/UpdateFilename.htm.
 
S

Suzanne S. Barnhill

You can also get more information and examples in Word's Help topics "Field
codes: If field" and "Examples of IF fields."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top