if...then...else

Y

Yve Ke

I would like to insert a series of if then else word fields into a mail merge
letter but if they are not satisified i want the whole thing suppressed
rather than have a space devoted to it. I guess it is something that you
have to do with switches but not sure how. Any help appreciated.

Yve
 
D

Doug Robbins - Word MVP

Do it like this:

{ IF { MERGEFIELD MiddleName } = "" "{ MERGEFIELD LastName }" "{ MERGEFIELD
MiddleName } { MERGEFIELD LastName }" }

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
Y

Yve Ke

Thanks for the advice about getting rid of the then...else but it still isn't
working. I want to do the following produce a list (sort of)
{ IF { MERGEFIELD Blah } = "Jack" "Jack" }
{ IF { MERGEFIELD BlahBlah} = "Jack" "Jack" }
{ IF { MERGEFIELD BlahBlahBlah} = "Jack" "Jack" " }
But if it isn't satsiafied it will give me a blank line which I don't want
Hope you can help

Yve
 
G

Graham Mayor

That's because you have your Blahs and Jacks in the wrong places. They need
to go on the same line and the line feed needs to be included between the
quotes.

{ IF { MERGEFIELD Blah } = "Jack" "Jack
" }{ IF { MERGEFIELD BlahBlah} = "Jack" "Jack
" }{ IF { MERGEFIELD BlahBlahBlah} = "Jack" "Jack
" }

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Y

Yve Ke

Thanks this is much better and suppresses empty fields BUT now I am getting
the spaces at the end - the list is quite long with, say, 10 lines but if
there are only a couple that is all the space I want devoted to it
Yve
 
G

Graham Mayor

The construction does not add any lines unless there is content in the
fields. These fields all go on the same line, immediately after and on the
same line as the field they follow. The next field goes immediately after
the construction.

Essentially you have

{Mergefield afield { IF { MERGEFIELD Blah } = "Jack" "Jack
" }Continue here

If there is nothing in the field Blah you get

{Mergefield afield} Continue here


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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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