A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

conditional field layouts



 
 
Thread Tools Display Modes
  #1  
Old September 9th, 2009, 07:54 PM posted to microsoft.public.word.mailmerge.fields
Peter
external usenet poster
 
Posts: 962
Default conditional field layouts

I'd appreciate help for setting alternate name and address layouts in a mail
merge. For example, the default layout might have these fields on 2 lines:

Suburb
City & PostCode

But if there is extra information in the full address, those fields might
need to go all on one line to meet constraints of page size, postal regs etc:

Suburb & City & PostCode

Any tips on how to do this would be appreciated.
  #2  
Old September 9th, 2009, 11:08 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default conditional field layouts

Broadly speaking, you can use IF fields to do some of this. For example
suppose you have two address lines, and if address2 is blank you want

address1
suburb
city postcode

but if it is non-blank you want

address1
address2
suburb, city postcode

then you can use

{ MERGEFIELD address1 }
{ IF "{ MERGEFIELD address2 }" = ""
"{ MERGEFIELD suburb }
{ MERGEFIELD city } { MERGEFIELD postcode }"
"{ MERGEFIELD address2 }
{ MERGEFIELD suburb }, { MERGEFIELD city } { MERGEFIELD postcode }" }

(or in this case

{ MERGEFIELD address1 }
{ IF "{ MERGEFIELD address2 }" = ""
"{ MERGEFIELD suburb }
" "{ MERGEFIELD address2 }
{ MERGEFIELD suburb }, " }{ MERGEFIELD city } { MERGEFIELD postcode }

etc. All the {} need to be the special "field code braces" that you can
insert using ctrl-F9.

Determining a layout based on the amount of text would be more difficult
- I don't think there's an obvious way to compare actual text width
unless you are using fixed-width fonts, but you may be able to get
character counts from your data source (depending on what it is) or do
comparisons using "wildcards" to determine character counts.

Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv

Peter wrote:
I'd appreciate help for setting alternate name and address layouts in a mail
merge. For example, the default layout might have these fields on 2 lines:

Suburb
City & PostCode

But if there is extra information in the full address, those fields might
need to go all on one line to meet constraints of page size, postal regs etc:

Suburb & City & PostCode

Any tips on how to do this would be appreciated.

  #3  
Old September 14th, 2009, 04:15 AM posted to microsoft.public.word.mailmerge.fields
Peter
external usenet poster
 
Posts: 962
Default conditional field layouts

Thanks for the suggestions, which look quite promising. I'll try them out
and get back to you if I get stuck.

"Peter Jamieson" wrote:

Broadly speaking, you can use IF fields to do some of this. For example
suppose you have two address lines, and if address2 is blank you want

address1
suburb
city postcode

but if it is non-blank you want

address1
address2
suburb, city postcode

then you can use

{ MERGEFIELD address1 }
{ IF "{ MERGEFIELD address2 }" = ""
"{ MERGEFIELD suburb }
{ MERGEFIELD city } { MERGEFIELD postcode }"
"{ MERGEFIELD address2 }
{ MERGEFIELD suburb }, { MERGEFIELD city } { MERGEFIELD postcode }" }

(or in this case

{ MERGEFIELD address1 }
{ IF "{ MERGEFIELD address2 }" = ""
"{ MERGEFIELD suburb }
" "{ MERGEFIELD address2 }
{ MERGEFIELD suburb }, " }{ MERGEFIELD city } { MERGEFIELD postcode }

etc. All the {} need to be the special "field code braces" that you can
insert using ctrl-F9.

Determining a layout based on the amount of text would be more difficult
- I don't think there's an obvious way to compare actual text width
unless you are using fixed-width fonts, but you may be able to get
character counts from your data source (depending on what it is) or do
comparisons using "wildcards" to determine character counts.

Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv

Peter wrote:
I'd appreciate help for setting alternate name and address layouts in a mail
merge. For example, the default layout might have these fields on 2 lines:

Suburb
City & PostCode

But if there is extra information in the full address, those fields might
need to go all on one line to meet constraints of page size, postal regs etc:

Suburb & City & PostCode

Any tips on how to do this would be appreciated.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:58 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.