View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
Stephen Bullen Stephen Bullen is offline
external usenet poster
 
Posts: 67
Default Repost: How to calc string's printable width?

Hi Paul,

Task at hand is to achieve this effect to print a directory:
Short Company Name....................Meredith Rockefeller
Long Company Name Truncated If Nece.......Judy Short

What we have here is left/right justified concatenation of:
LEFT(CompanyName,x) & "...y.dots..." & Contact
So we seek a solution to figure out x and y. Maybe some library offers such
facility?
AutoFill certainly manages to work out the widths 1 by 1 but can this be
bettered?


One possibility is to use a text box on the sheet set to AutoSize and not
word wrap, put each half of your text in it, then read the width. However,
when you come to print the sheet, the printer font substitution will probably
misalign the right-hand sides anyway. It might be better to use Word instead,
where you can set a flush-right tab stop.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk