conditional text - if else

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone give me a quick primer on setting up conditional text where;
if cond=true then xxx else yyyy
 
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.
 
You can also get more information and examples in Word's Help topics "Field
codes: If field" and "Examples of IF fields."

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Back
Top