ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to calculate cell's contents printable width? (https://www.excelbanter.com/excel-programming/284676-how-calculate-cells-contents-printable-width.html)

count

How to calculate cell's contents printable width?
 
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



Tim Williams

How to calculate cell's contents printable width?
 
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

"count" wrote in message
...
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





count

How to calculate cell's contents printable width?
 
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
Użytkownik "Tim Williams" <saxifrax@pacbell*dot*net napisał w wiadomości
...
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

"count" wrote in message
...
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








All times are GMT +1. The time now is 05:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com