Thread: Form Resize
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Form Resize

Hi Suzette:

Alternatively, try the following API-based routine:

Option Explicit

Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As _
Any) As Long

Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTBOTTOMRIGHT = 17
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
_
lpClassName As String, ByVal lpWindowName As String) As Long

Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As _
Integer, ByVal X As Single, ByVal Y As Single)
Dim lngHwnd As Long
If X = Me.Width - 10 Then
If Y = Me.Height - 30 Then
lngHwnd = FindWindow(vbNullString, Me.Caption)
ReleaseCapture
SendMessage lngHwnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, ByVal 0&
End If
End If
End Sub

Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As _
Integer, ByVal X As Single, ByVal Y As Single)
If X = Me.Width - 10 Then
If Y = Me.Height - 30 Then
Me.MousePointer = fmMousePointerSizeNWSE
'Unfortunately, in Excel 2002, the pointer doesn't change shape until
after you click the
'bottom right-hand corner of the UserForm. It worked just fine in Excel
97.
End If
Else
Me.MousePointer = fmMousePointerDefault
End If
End Sub

Regards,

Vasant.


"Suzette" wrote in message
...
I can't seem to find a way to make a form resizable in VBA. Anyone out
there with an idea... or can point out my stupidity?

Thanks

Suzette