IF/THEN/ELSE adds a blank line in mail merge WORD 2007

G

gabo

Hello,

I need to merge some mailings based on if the first name is not the
same as nickname, print nickname else don't print anything and go to
the next field. The code I have is:

{IF {MERGEFIELD fName} <> {MERGEFIELD nName} {MERGEFIELD nName} ""}


What is happening is if the first name and nickname are the same a
blank line appears. How do I supress the blank line?
 
S

Suzanne S. Barnhill

Make the line break part of your TrueText (note that you don't have to
include FalseText if it's "nothing"). So you'll have:

{I F { MERGEFIELD fName } <> { MERGEFIELD nName } "{ MERGEFIELD nName }
" }

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
 
G

gabo

Make the line break part of your TrueText (note that you don't have to
include FalseText if it's "nothing"). So you'll have:

{I F { MERGEFIELD fName } <> { MERGEFIELD nName } "{ MERGEFIELD nName }
" }

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USAhttp://word.mvps.org









- Show quoted text -

Thank you,

I have for the code:

{ IF{ MERGEFIELD fName } <> {MERGEFIELD nName } "{MERGEFIELD nName }
"}

and this stil shows a blank line. for the quotes I've used double/
single and it is still inserting a blank line
 
D

Doug Robbins - Word MVP

If you want the firstname on one line and the nickname if it is not the same
as the firstname on the next line, use the following field construction

{ MERGEFIELD fName }{ IF { MERGEFIELD fName } = { MERGEFIELD nName } "" "¶
{ MERGEFIELD nName }" }

Where you press the Enter key (or Shift+Enter) where the ¶ appears.

--
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, originally posted via msnews.microsoft.com
 
S

Suzanne S. Barnhill

Did you remove the line break you had *after* the mergefield? Note that the
mergefield for your next line should immediately follow this one:

{ IF{ MERGEFIELD fName } <> {MERGEFIELD nName } "{MERGEFIELD nName }
"}{ MERGEFIELD whatever }

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org

Make the line break part of your TrueText (note that you don't have to
include FalseText if it's "nothing"). So you'll have:

{I F { MERGEFIELD fName } <> { MERGEFIELD nName } "{ MERGEFIELD nName }
" }

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USAhttp://word.mvps.org









- Show quoted text -

Thank you,

I have for the code:

{ IF{ MERGEFIELD fName } <> {MERGEFIELD nName } "{MERGEFIELD nName }
"}

and this stil shows a blank line. for the quotes I've used double/
single and it is still inserting a blank line
 

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