Dropping a UserForm

  • Thread starter Thread starter Rune_Daub
  • Start date Start date
R

Rune_Daub

Is there any way that I can make a UserForm drop to the bottom of the
screen and automaticly stretch to fill the entire width of the screen.
The catch is that it has to adjust it self automaticly to the width of
the screen, no matter what resolution the screen is in.

How do I do that.

Thx..

Rune Daub
 
You can make the userform larger, but it isn't a zoom type operation - the
controls on the form will not resize:

Sub UserForm_Activate()
With Application
'maximize Excel
.WindowState = xlMaximized
Me.Top = .Top
Me.Left = .Left
Me.Height = .Height
Me.Wdith = .Width
End With
End Sub


Sub FormFit()
UserForm1.Show
End Sub

The above assumes excel is maximized. (I added code to maximize it)

To get more information on manipulating userforms with code, see Stephen
Bullens formfun download.
http://www.bmsltd.co.ie/Excel/Default.htm

With reference to what is shown in FormFun.zip, Stephen Bullen posted the
following advice for maximizing:

Hi Gerry,
That example does allow you to maximize the form if the maximize option is
selected. Would it be difficult to cause the form to start maximized, rather than
at the originally defined size? Basically, I'd like to pre-select
Maximized.

Sure, it's just a different constant passed to the ShowWindow API that's
already in
there. [in the formfun code] To show a form maximised, use this:

At the top of the module

Private Const SW_MAXIMIZE = 3

In the Form Property Set:

'Show Maximized
ShowWindow hWndForm, SW_MAXIMIZE

after setting the form's style bits.

Regards

Stephen Bullen
Microsoft MVP - Excel

=================
This post by Stratos Malasiotis shows a method probably similar to
Stephen's, but is complete and primarily addresses sizing:

http://groups.google.com/[email protected]
 
Back
Top