Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Stretching a userform with the mouse

Hi,

I have a workbook that uses a userform to display some help text. (.pdf)

I use the "WebBrowser" control to do so. I set a default size of 640 x 480
for the userform. However I would like the user be able to modify the window
size the way we usually do: stretching it by the lower right corner.

If someone could help me with that challenge, I would appreciate.

Thanks

Pierre




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Stretching a userform with the mouse


Hello Pierre,

Add a new VBA module to your project and copy the following code into
it.

CALLING THE FORM RESIZE CODE:
In the UserForm Activate event add the following line...

Call MakeFormResizable


Code:
--------------------

'API calls and constants
'
'Returns the Window Handle of the Active Window
Public Declare Function GetActiveWindow _
Lib "User32.dll" () As Long

Private Declare Function GetWindowLong _
Lib "User32.dll" _
Alias "GetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong _
Lib "User32.dll" _
Alias "SetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Const GWL_STYLE As Long = (-16) 'The offset of a window's style
Private Const WS_THICKFRAME As Long = &H40000 'Style to add a sizable frame

Public Sub MakeFormResizable()

Dim lStyle As Long
Dim hWnd As Long
Dim RetVal

hWnd = GetActiveWindow

'Get the basic window style
lStyle = GetWindowLong(hWnd, GWL_STYLE) Or WS_THICKFRAME

'Set the basic window styles
RetVal = SetWindowLong(hWnd, GWL_STYLE, lStyle)

End Sub

--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=495084

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Stretching a userform with the mouse

Thank you very much

Pierre

"Leith Ross" a
écrit dans le message de
...

Hello Pierre,

Add a new VBA module to your project and copy the following code into
it.

CALLING THE FORM RESIZE CODE:
In the UserForm Activate event add the following line...

Call MakeFormResizable


Code:
--------------------

'API calls and constants
'
'Returns the Window Handle of the Active Window
Public Declare Function GetActiveWindow _
Lib "User32.dll" () As Long

Private Declare Function GetWindowLong _
Lib "User32.dll" _
Alias "GetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong _
Lib "User32.dll" _
Alias "SetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Const GWL_STYLE As Long = (-16) 'The offset of a

window's style
Private Const WS_THICKFRAME As Long = &H40000 'Style to add a sizable

frame

Public Sub MakeFormResizable()

Dim lStyle As Long
Dim hWnd As Long
Dim RetVal

hWnd = GetActiveWindow

'Get the basic window style
lStyle = GetWindowLong(hWnd, GWL_STYLE) Or WS_THICKFRAME

'Set the basic window styles
RetVal = SetWindowLong(hWnd, GWL_STYLE, lStyle)

End Sub

--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:

http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=495084



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
WordArt - stretching aehdbe Excel Discussion (Misc queries) 0 March 28th 08 06:36 PM
HELP..Stretching on print out Henry Excel Discussion (Misc queries) 0 April 20th 06 05:30 PM
fly wheel on a mouse and a userform MD Excel Programming 2 May 14th 05 07:21 PM
How to create labels in a UserForm dynamically and be able to resize them with the mouse. Pierre Archambault Excel Programming 0 November 23rd 04 08:39 PM
stretching cells libby Excel Programming 2 January 13th 04 06:01 PM


All times are GMT +1. The time now is 01:56 AM.

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

About Us

"It's about Microsoft Excel"