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  

Limiting text to one line



 
 
Thread Tools Display Modes
  #1  
Old January 13th, 2009, 12:04 AM posted to microsoft.public.word.mailmerge.fields
Mark
external usenet poster
 
Posts: 1,534
Default Limiting text to one line

The main document that we use for a mail merge has a line for the name of the
company. This name merges from the database. How do I get the company name
to only fit on the one line regardless of length, within reason?


  #2  
Old January 13th, 2009, 01:23 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Limiting text to one line

Your best bet is if you can modify your data source to return a number
that is related to the length of the text. For example, if your data
source is Access, you may be able to create a query that returns the
number of characters in the company name. Then you can use a nested if
field that inserts the name formatted at various different point sizes
(or perhaps you squeeze the cahracters together a bit on particularly
long addresses).

e.g. you have a new field called textlen and you do something like

{ IF { MERGEFIELD textlen } 40 "{ MERGEFIELD companyname \*Charformat
}" "{ IF { MERGEFIELD textlen } 60 "{ MERGEFIELD companyname
\*Charformat }" "etc." }" }

where each { MERGEFIELD companyname \*Charformat } field is formatted
the way you want.

Obviously unless you are using a fixed width font the character count is
only a guide to the width of the inserted text but you can probably find
an approach that will work except in extreme cases.

If you can't get a measure of the text length from the data source, you
could I suppose do the same thing using a whole lot of IF fields that
use wildcards. In this case you would not need to nest. e.g.

{ IF { MERGEFIELD companyname } = "?" "{ MERGEFIELD companyname
\*Charformat }" ""
}{ IF { MERGEFIELD companyname } = "??" "{ MERGEFIELD companyname
\*Charformat }" ""
}{ IF { MERGEFIELD companyname } = "???" "{ MERGEFIELD companyname
\*Charformat }" ""
}{ IF { MERGEFIELD companyname } = "????" "{ MERGEFIELD companyname
\*Charformat }" ""
}

etc. Not sure how far that approach gets you but it's fairly easy to set
up and test.


Peter Jamieson

http://tips.pjmsn.me.uk

Mark wrote:
The main document that we use for a mail merge has a line for the name of the
company. This name merges from the database. How do I get the company name
to only fit on the one line regardless of length, within reason?


 




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 05:53 PM.


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