How to calculate cell's contents printable width?

  • Thread starter Thread starter count
  • Start date Start date
C

count

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

Trival task in Word but how to do it programatically in Excel?
Components I think I need are calculations of printable width of cell
contents.
I then do my sums and take as much of Company Name and dots "........." to
fit a cell, given length of the Contact Name.

Other suggestions are warmly welcome :)
Paul
 
This is on the fly, or just to set up a static report? For a proportional
font it may not be so easy....
One way to do it might be to put each string into a cell in a column by
itself and call "autofit", adjusting the length of the text until the column
is the size you need, then on to the next item etc. A bit of a kludge but
should work.

Tim
 
Thanks Tim,
I thought this AutoFit might itself be calling a subroutine from some
library or other; Word-ish? :)
But which? Which? To this day I dunno what libraries have on offer.
Report will be generating "on the fly" pretty "DayRunner" inserts. The list
is a directory to the main contents, translating Company into Surname;
variable lengths are useful, so I can put maybe more identifiable details
e.g.
Big Company, Seattle..............John Doe
Florist Shop, Crown St.............Michelle

My previous version employed Excel and Word - now I'm trying to keep things
tight
Paul
 
Back
Top