Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default resizing columns with pixels

I want to be able to specify column widths in pixels
rather than points. I can call the function for column
widths in VBE but can't find an option to specify a width
in pixels (even though this value is always shown when
manually resizing)

Help would be great,
Cheers
Andy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default resizing columns with pixels

Hi Andy;
MsgBox Columns(1).ColumnWidth ' Points
MsgBox Columns(1).ColumnWidth * 4 / 3 ' Pixels

"Andy" a écrit dans le message de
...
I want to be able to specify column widths in pixels
rather than points. I can call the function for column
widths in VBE but can't find an option to specify a width
in pixels (even though this value is always shown when
manually resizing)

Help would be great,
Cheers
Andy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default resizing columns with pixels

Ta for the suggestion but it doesn't work. I have tried
to find a relationship between points and pixels but as
points are based on the standard font size the bigger the
column width the more (different sized letters) can fit
in. I do know that the relationship is definatley not
linear. I think I need to actually specify number of
pixels rather than converting into points

Any ideas?

Andy




-----Original Message-----
Hi Andy;
MsgBox Columns(1).ColumnWidth ' Points
MsgBox Columns(1).ColumnWidth * 4 / 3 ' Pixels

"Andy" a écrit dans

le message de
...
I want to be able to specify column widths in pixels
rather than points. I can call the function for column
widths in VBE but can't find an option to specify a

width
in pixels (even though this value is always shown when
manually resizing)

Help would be great,
Cheers
Andy



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default resizing columns with pixels

Andy wrote:
Ta for the suggestion but it doesn't work. I have tried
to find a relationship between points and pixels but as


Have you looked at the methods PointsToScreenPixelsX and
PointsToScreenPixelsY of the Window object?

points are based on the standard font size the bigger the
column width the more (different sized letters) can fit
in. I do know that the relationship is definatley not
linear. I think I need to actually specify number of
pixels rather than converting into points

Any ideas?

Andy





-----Original Message-----
Hi Andy;
MsgBox Columns(1).ColumnWidth ' Points
MsgBox Columns(1).ColumnWidth * 4 / 3 ' Pixels

"Andy" a écrit dans


le message de

...

I want to be able to specify column widths in pixels
rather than points. I can call the function for column
widths in VBE but can't find an option to specify a


width

in pixels (even though this value is always shown when
manually resizing)

Help would be great,
Cheers
Andy



.





--
Steve Garman

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default resizing columns with pixels

Hi Andy; test this:

Private Declare Function GetWindowRect Lib "user32" _
(ByVal hwnd As Long, lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Sub PixelsPointsRate()
Application.WindowState = xlMaximized
Dim R As RECT
GetWindowRect Application.hwnd, R
MsgBox "Pixels - Points: " & Application.Width / (R.Right - R.Left)
End Sub

If Pixels to Points = 3/4 Then Points To Pixels = 4/3 !

"Andy" a écrit dans le message de
...
Ta for the suggestion but it doesn't work. I have tried
to find a relationship between points and pixels but as
points are based on the standard font size the bigger the
column width the more (different sized letters) can fit
in. I do know that the relationship is definatley not
linear. I think I need to actually specify number of
pixels rather than converting into points

Any ideas?

Andy




-----Original Message-----
Hi Andy;
MsgBox Columns(1).ColumnWidth ' Points
MsgBox Columns(1).ColumnWidth * 4 / 3 ' Pixels

"Andy" a écrit dans

le message de
...
I want to be able to specify column widths in pixels
rather than points. I can call the function for column
widths in VBE but can't find an option to specify a

width
in pixels (even though this value is always shown when
manually resizing)

Help would be great,
Cheers
Andy



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 214
Default resizing columns with pixels

Sorry Andy;
You must use the width property and not columnwidth.
MsgBox Columns(1).Width 'Points
MsgBox Columns(1).Width * 4 / 3 'Pixels
Regards

"Andy" a écrit dans le message de
...
I want to be able to specify column widths in pixels
rather than points. I can call the function for column
widths in VBE but can't find an option to specify a width
in pixels (even though this value is always shown when
manually resizing)

Help would be great,
Cheers
Andy



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resizing columns with a macro belvy123 Excel Discussion (Misc queries) 7 June 28th 09 04:27 PM
resizing columns syssupspe Excel Discussion (Misc queries) 1 May 23rd 06 05:13 PM
Macro for resizing of columns? MatthewTap Excel Discussion (Misc queries) 2 December 1st 05 06:48 PM
some columns 30 characters 155 pixels others 310 pixels why vurden Excel Discussion (Misc queries) 2 April 26th 05 03:30 AM
Resizing columns Jill Leyland Excel Discussion (Misc queries) 1 January 27th 05 03:59 PM


All times are GMT +1. The time now is 11:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"