View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default How do you resize a Multi Page User Form?

Here is some code with a user's comments that I copied off the web. As you
can see it goes into the application files to employ the controls.
===============
#1 02-26-2005, 11:06 AM
RB Smissaert
Guest Posts: n/a

Minimize and maximize buttons userforms

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

Please Register to Remove these Ads

How do I add minimize and maximize buttons to a VBA userform?
I have this code that does it, but when I change the caption of the
userform
the buttons don't work anymore. I am slowly coming to the conclusion
that
it probably is not worth the trouble and that it is better to make
your own
buttons.

Public Declare Function FindWindow _
Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As Long, _
ByVal lpWindowName As Long)

Private Declare Function SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Sub UserForm_Initialize()

Dim hWnd as Long

hWnd = FindWindow(vbNullString, UserForm1.Caption)
SetWindowLong hWnd, -16, &H20000 Or &H10000 Or &H84C80080

End Sub










"Brian" wrote in message
...
Tried it too. 1/3 of the User Form is cut off.

How can I get the Min/Max Buttons on the User Form?

"JLGWhiz" wrote:

Hi Brian, I tested this and it might suit your puirpose more that the
previous code.

Private Sub UserForm_Initialize()
Me.Height = Application.UsableHeight
Me.Width = Application.UsableWidth
End Sub


"Brian" wrote in message
...
I have a Multi Page User Form that I need to be able to resize according
to
Monitor Size and Resolution?

I saw on Chip Pearsons site some code for resizing a User form, but I
am
not
sure how to use it. I don't want to possibly mess up my computer
settings.

It would be nice if my User Form would have a Min, Max & Close button
like
most Windows apps have. Is it possible to get the User Form to
Automaticaly
resize according to Monitor size and resolution?



.