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