Re: pixels, twips and things
Quote:
Originally Posted by jsteel
Im trying to dump the contents of an MSFlexGrid into an excel sheet and set the widths of the excel columns to be the same as the flex grid. I have a couple problems.
1. I can't find the units of measurement used by a flex grid.
2. Excel uses a unit of measurement that is the number of average sized characters that can fit in a cell. Well how do i convert from pixels, or whatever the flex grid is using, to this weird system?
Thanks
The flex grid uses TWIPS (1/20 of a printer point).
72 points per inch
20 twips to a point
1440 twips per inch
The FLEXGRID has a .TEXTWIDTH property that will give you the TWIP size of any string you pass it.
I'm not sure how EXCEL does the average - you could pass each character - A to Z to .TEXTWIDTH and strike an average in VB - not sure if that is a match though.
Re: pixels, twips and things
BTW - Welcome to the forum!
Re: pixels, twips and things
szlamany beat me to the different scales, but here's the what you need for Excel (from Excel's help for ColumnWidth):
"Use the Width property to return the width of a column in points."
As 1 point = 20 twips, you just need to divide the Grid sizes by 20.