Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] diane@discussions.microsoft.com is offline
external usenet poster
 
Posts: 2
Default If the mergefield is blank, delete the line.

I would like to print addresses. All of the addresses do not have the same
number of lines.

Name
Address 1
Address 2
City, State, Zip

Name
Address 1
City, State Zip

When Address 2 = N.A., I would like the merge to delete the line so the
address looks like the second example.
Many thanks.
--
diane
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default If the mergefield is blank, delete the line.

You don't delete the line, but insert it only when it has content. Thus you
need to conditionally insert the field eg

{Mergefield Name}
{Mergefield Address1}{If{Mergefield Address2} "" "
{Mergefield Address2}"}
{Mergefield City} etc

You can use the same method for as many fields as may be empty.

Also if you use the old mailmerge helper -
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm you should have
the option to suppress blank lines in addresses - but the former method is
simpler and more reliable.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




wrote:
I would like to print addresses. All of the addresses do not have
the same number of lines.

Name
Address 1
Address 2
City, State, Zip

Name
Address 1
City, State Zip

When Address 2 = N.A., I would like the merge to delete the line so
the address looks like the second example.
Many thanks.



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] diane@discussions.microsoft.com is offline
external usenet poster
 
Posts: 2
Default If the mergefield is blank, delete the line.

Thank you, Graham. I have inserted the line you suggested as follows:
«ADDRESS»} {If{Mergefield Street_Address_3} "" "
{Mergefield Street_Address_3}"}
«City_of_Residence»
«State_of_Residence_Code», «Zip_Code»

However, when I do the merge, this is what is happening:
268 Redding Road } {If{Mergefield Street_Address_3} "" "
{Mergefield Street_Address_3}"}
Atlanta

Can you tell me what I've done wrong?
Many thanks,
Diane
GA, 30319

--
diane


"Graham Mayor" wrote:

You don't delete the line, but insert it only when it has content. Thus you
need to conditionally insert the field eg

{Mergefield Name}
{Mergefield Address1}{If{Mergefield Address2} "" "
{Mergefield Address2}"}
{Mergefield City} etc

You can use the same method for as many fields as may be empty.

Also if you use the old mailmerge helper -
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm you should have
the option to suppress blank lines in addresses - but the former method is
simpler and more reliable.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




wrote:
I would like to print addresses. All of the addresses do not have
the same number of lines.

Name
Address 1
Address 2
City, State, Zip

Name
Address 1
City, State Zip

When Address 2 = N.A., I would like the merge to delete the line so
the address looks like the second example.
Many thanks.




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default If the mergefield is blank, delete the line.

You didn't use CTRL+F9 for the field boundarie pairs {}

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


wrote:
Thank you, Graham. I have inserted the line you suggested as follows:
«ADDRESS»} {If{Mergefield Street_Address_3} "" "
{Mergefield Street_Address_3}"}
«City_of_Residence»
«State_of_Residence_Code», «Zip_Code»

However, when I do the merge, this is what is happening:
268 Redding Road } {If{Mergefield Street_Address_3} "" "
{Mergefield Street_Address_3}"}
Atlanta

Can you tell me what I've done wrong?
Many thanks,
Diane
GA, 30319


You don't delete the line, but insert it only when it has content.
Thus you need to conditionally insert the field eg

{Mergefield Name}
{Mergefield Address1}{If{Mergefield Address2} "" "
{Mergefield Address2}"}
{Mergefield City} etc

You can use the same method for as many fields as may be empty.

Also if you use the old mailmerge helper -
http://www.gmayor.com/mail_merge_lab...th_word_xp.htm you should
have the option to suppress blank lines in addresses - but the
former method is simpler and more reliable.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




wrote:
I would like to print addresses. All of the addresses do not have
the same number of lines.

Name
Address 1
Address 2
City, State, Zip

Name
Address 1
City, State Zip

When Address 2 = N.A., I would like the merge to delete the line so
the address looks like the second example.
Many thanks.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
double window envelope tpdebronsky Page Layout 5 May 18th 23 08:51 PM
If...Then Micah Mailmerge 2 October 17th 06 02:56 PM
leave a blank line when merging stlof Mailmerge 3 September 29th 06 06:04 PM
mail merging formatted content donna Mailmerge 18 July 28th 06 06:20 PM
How to delete a line created by equal signs? It won't delete from dial911book Microsoft Word Help 4 April 25th 05 01:17 PM


All times are GMT +1. The time now is 04:19 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"