Using double quotes in IF results

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

Guest

Does anyone know how to include double quotes in the results of an IF
express, as in:

{ IF TextString = "anytext" "This is the "true" result" "This is the "false"
result" }

Any help is greatly appreciated.
 
Use a nested {Symbol 034} field in each place you want the quote symbol
to appear. E.g.,


"....{Symbol 034}true{Symbol 034}..."
 
034 will give you straight quotes. If you want the curly ones, you'll need
to use 147 (left) and 148 (right). Alternatively, you can use two single
quotes.

--
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.
 
Thanks to both of you for your responses. Unfortunately, this doesn't always
work. Specifically, it's failing for me if the {symbo} field is the first or
last thing in the result text. Try this:
{ IF "a"="b" "{Symbol 034}text1{Symbol 034}" "{Symbol 034}text2{Symbol 034}" }
Yields: text2

Now try this:
{ IF "a"="b" "my{Symbol 034}true{Symbol 034}text" "my{Symbol
034}false{Symbol 034}text" }
Yields: my"false"text

I can only speculate why Word is dropping the quotes in the first example.
Is this a bug or is there some nuance of this feature that is eluding me? If
all else fails I can continue to use two single quotes.

Again, any help you can provide is greatly appreciated.
 
Joey,

Odd. Replace { Symbol 034 } with { Quote 34 }. That is working here with
your example.
 
Or even cleaner with your example:

{ IF "a"="b"{ Quote 34 text1 34 }{ Quote 34 text2 34}}
 
Joey,

Here is an example when the quoted text is first, last, or in the middle.

{ IF "a"="a"{ Quote 34 True 34 }{ Quote "This is a " 34 false 34 "
statement" }}
 
And if all else fails save the texts as autotext entries and insert autotext
fields in the conditional statement to place them.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Does anyone know how to include double quotes in the results of an IF
express, as in:

{ IF TextString = "anytext" "This is the "true" result" "This is the "false"
result" }

Any help is greatly appreciated.

Below are a few methods.

Note that it comes out somewhat hard to read in the newsgroup because
both the straight and curly quotes look the same. You will need to use
a bit of imagination to get the picture. The idea is that the quote
marks around the target quotation are supposed to be curly, and the
quote marks that separate portions of the field codes are supposed to
be straight.

Bob S


Quoted Text in IF Fields

Trying to put text that contains embedded quotation marks into the
true or false text of IF field codes can be "interesting". There are a
couple ways to do it. As an example, suppose that you want the output
of an IF field to look like this:

Say "cheese!"

One scheme is to use the QUOTE field to produce the correct quotes.
For example:

{ IF Something "Say { QUOTE "\"" }cheese!{ QUOTE "\"" }" "No!" }

It is inordinately difficult to get this to work. The only way that I
could get the QUOTE fields correct was to use CTRL+F9 to get the
brackets and type directly. Using the Insert | Field dialog produced
straight quotes not curly quotes. Also note that to get the opening
quotes in the first QUOTE field, I typed "\ "" and then deleted the
space character.

Another alternative is to use a pair of single quote characters to
make something that looks somewhat like double quotes:

{ IF Something "Say ''cheese!''" "No!" }

Again, it is unreasonably difficult to get this to work. I had to use
CTRL+F9 to get the brackets (instead of Insert | Field), then type
QUOTE instead of IF (If I used IF I would get straight quotes when I
typed the rest of the text!) and type in the rest of the field, and
then go back and change the QUOTE to IF. Also, to get the two single
opening quotes I had to start with a space between them and then
delete the space.

While you are trying these things, remember to update field codes
every time that you change something.

My favorite scheme at the moment is to first type the correct text,
type QUOTE in front of it, put backslashes in front of the internal
quote characters, add the straight quote characters needed by the
QUOTE field, use CTRL+F9 to put field brackets around it, type in the
rest of the IF field stuff, and then select the whole field code and
use CTRL+F9 to put field brackets around that. It all has to be done
in order.

The process is:

Say "cheese!"
QUOTE Say "cheese!"
QUOTE Say \"cheese!\"
QUOTE "Say \"cheese!\""
{ QUOTE "Say \"cheese!\""}
{ IF Something { QUOTE "Say \"cheese!\""} "No!" }


A different approach was suggested by "macropod". Use the ASCII
numbers for the quote characters, inside QUOTE fields.

{ IF Something "Say { QUOTE 34 }cheese!{ QUOTE 34 }" "No!" }

34 straight double quote
147 left curly double quote
148 right curly double quote
39 straight single quote
145 left curly single quote
146 right curly single quote
 
Also note that to get the opening
quotes in the first QUOTE field, I typed "\ "" and then deleted the
space character.

Not necessary if you use the keyboard shortcuts to insert these directly:\

Ctrl+`, ` = opening single quote
Ctrl+', ' = closing single quote or apostrophe

--
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.
 
What am I missing here? The sequence I need here (which I admit is not
instantly apparent from the text-only newsgroup posting) is

straight double quote
backslash
opening curly double quote
straight double quote

The straight quotes are needed for the QUOTE field code, the curly
quote is ultimately part of the quoted text.

With automatic curly quotes enabled, the way I get it is

double quote
^z to undo curliness
backslash
space
double quote - automatically becomes opening curly quote; without the
space it becomes a closing curly qoute instead
delete the space
double quote
^z to undo curliness

How do shortcuts for single quotes ease this process?

Bob S
 
You don't need the QUOTE field at all if you use single quotes, and they
don't require backslashes. That is, instead of using double quotes with a
backslash (which often doesn't work for the closing one, anyway, use two
single quotes instead.

--
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