Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I ran this little piece of code to test the PointsToScreenPixelsX and
PointsToScreenPixelsY methods. It's better to run the code using a command button placed on a spreadsheet, otherwise the active window may change to a window other than the one with the selected cells in, which causes the methods to return 0. Dim oCell As Range For Each oCell In Selection oCell.Value = "W = " & ActiveWindow.PointsToScreenPixelsX(oCell.Width) & _ ", H = " & ActiveWindow.PointsToScreenPixelsY(oCell.Height) Next According to the VBA documentation the methods "convert a vertical measurement from points (document coordinates) to screen pixels (screen coordinates). Returns the converted measurement as a Long value." That doesn't appear to be the case. I can see what the pixel size of any column or row is by adjusting the width using the column and row markings on the header. Whatever numbers PointsToScreenPixels is returning, they are not pixels. In fact, there is an inverse relationship between the number returned and the actual width or height of the column or row. In other words, if the width or height is larger, the value returned by PointsToScreenPixels is smaller. If anyone can help me sort out this mystery and retrieve the REAL width and height of any given column or row I would greatly appreciate it. Thanks. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Documentation | Excel Programming | |||
Documentation | Excel Programming | |||
PointsToScreenPixels for Excel97 | Excel Programming | |||
VBA Documentation | Excel Programming | |||
Documentation | Excel Programming |