ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ColumnWidth (https://www.excelbanter.com/excel-programming/377188-columnwidth.html)

abhimanyu

ColumnWidth
 
Hi

I need to set Excel;s cell ColumnWidth in pixels instead of Points. I
have a picture that I need to put over the cell, for this I need to
resize cell accordingly.

thanks


Jim Rech

ColumnWidth
 
Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex
As Long) As Long
Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As
Long) As Long
Const LOGPIXELSX = 88
Const POINTS_PER_INCH As Long = 72

Function PointsPerPixel() As Double
Dim hDC As Long
Dim lDotsPerInch As Long
hDC = GetDC(0)
lDotsPerInch = GetDeviceCaps(hDC, LOGPIXELSX) ''Get the user's DPI
setting
PointsPerPixel = POINTS_PER_INCH / lDotsPerInch
ReleaseDC 0, hDC
End Function


--
Jim
"abhimanyu" wrote in message
oups.com...
| Hi
|
| I need to set Excel;s cell ColumnWidth in pixels instead of Points. I
| have a picture that I need to put over the cell, for this I need to
| resize cell accordingly.
|
| thanks
|




All times are GMT +1. The time now is 04:18 PM.

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