IF condition in mailmerge does not get rid of blank line in word 2013

The following code should get rid of the line however does not:

{IF {MERGEFIELD ProdCode}<>"ANTY" "Paragrah" ""}

Please advise

You need to have the paragraph or line break inside your TrueText:

{ IF { MERGEFIELD ProdCode }<>"ANTY" "Paragraph
" "" }

You can omit the FalseText entirely since it is null:

{ IF {MERGEFIELD ProdCode }<>"ANTY" "Paragraph
" }

Microsoft MVP (Word) since 1999
Fairhope, Alabama USA
http://ssbarnhill.com
http://wordfaqs.ssbarnhill.com
Screen shots captured with TechSmith's Snagit

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Suzanne,

Yes I tried your suggestion however seems like the line elimination does not work in conjunction with other switches.

medical software specialist

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

There are no switches in that field. What "other switches"?
Microsoft MVP (Word) since 1999
Fairhope, Alabama USA
http://ssbarnhill.com
http://wordfaqs.ssbarnhill.com
Screen shots captured with TechSmith's Snagit

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Suzanne

The template is complicated it has several switches and is linked to an Access table.

The simplest way to explain this issue to you is as follow:

Template:

Hi

{ IF { MERGEFIELD ProdCode }<>"ANTY" "Paragraph" "" }

Thanks

If Prodcode<>"ANTY" then final word doc:

Hi

Paragraph

Thanks

If Prodcode="ANTY" then final word doc: 

Hi

Thanks

The extra space is not eliminated as you can see in this simple example.

If you have a change please try it yourself, seems like is a bug in Word.

I am still try to find a solution how to eliminate the extra line if no data is available.

Thanks

Norbert

medical software specialist

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

In this situation, you could use:

Hi { IF { MERGEFIELD ProdCode }<>"ANTY" "
Paragraph" }
Thanks

Or:

Hi

{ IF { MERGEFIELD ProdCode }<>"ANTY" "Paragraph

" }Thanks

In other words, the paragraph break before the inserted text or following it must be included as part of the TrueText; if the TrueText does not appear, then neither will the paragraph break. That is not "complicated" at all.

Microsoft MVP (Word) since 1999
Fairhope, Alabama USA
http://ssbarnhill.com
http://wordfaqs.ssbarnhill.com
Screen shots captured with TechSmith's Snagit

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

It will probably help you understand what Suzanne is telling you if you turn on display of non-printing formatting marks.

Showing non-printing formatting marks in Microsoft Word

Volunteering to "pay forward" the help I've received in the Microsoft user community.


Charles Kenyon
Sun Prairie, Wisconsin
wordfaq[at]addbalance[dot]com

Legal site: https://addbalance.com

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Indeed. With nonprinting characters (formatting marks) displayed, the above would be:

Hi { IF { MERGEFIELD ProdCode }<>"ANTY" "
Paragraph" }
Thanks

Or:

Hi

{ IF { MERGEFIELD ProdCode }<>"ANTY" "Paragraph

" }Thanks

Microsoft MVP (Word) since 1999
Fairhope, Alabama USA
http://ssbarnhill.com
http://wordfaqs.ssbarnhill.com
Screen shots captured with TechSmith's Snagit

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 69 Applies to: