Make Userform go Fullscreen

Gregs

Board Regular
Joined
Sep 6, 2002
Messages
96
Hi Mr Excel,

Just want to know how you make a Userform go full screen when the spreadsheet is opened. At the moment, when I open the spreadsheet the userform is Auto_Open but I want it to be fullscreen or if I click on a button to generate it I also may want full screen.

Any help would be much appreciated.

Gregs
 
DragRacer is correct, the .Zoom is not perfect. But it does work pretty well, as long as the aspect ratios of the various display resolutions are close.

You need to design your form "actual size", if you can. If that involves resizing your display when you get to certain points in form design, so be it.

From 1024 x 768 to 800 x 600 tends to trim off the bottom of the form, but there wasn't anything down there to begin with.

The form in question is jammed with stuff: four comboboxes, two listboxes, 14 option buttons, two checkboxes, one spin control, four commandbuttons, ten frames.

It works well, not perfect. IntegralHeight goes bonkers on the bigger Listbox, so I don't use it.

And remember, Microsoft's controls aren't perfect, but they ARE free. :)
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hello,

Here's a solution that sizes the userform and the controls on the userform. Also, it uses an API call to determine the users screen resolution and sizes both accordingly.

Here's the code:

'First the 32-bit API declaration. Placed above the code that follows...

'''''''''''''''''''''''

Declare Function GetSystemMetrics Lib "user32" _
(ByVal nIndex As Long) As Long

Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1

'now the code. Change references to "ufMain" to the name of your userform. Also, LB1 below is a listbox on my userform. Remove this if you don't need it.

'''''''''''''''''''''''''

' Show your userform

ufMain.Show

' get size of users screen

Dim vidWidth As Variant
Dim vidHeight As Variant

vidWidth = GetSystemMetrics(SM_CXSCREEN)
vidHeight = GetSystemMetrics(SM_CYSCREEN)

If vidWidth = 800 Then
ufMain.Height = Application.Height - 107

GoTo byeBye

End If

If vidWidth = 1024 Then GoTo 1024
MsgBox "Please adjust your screen resolution to 800 x 600 or 1024 x 768"
Exit Sub

1024:

Dim ctrl As Control

If ufMain.Height = Application.Height - 107 Then GoTo byeBye

ufMain.Width = ufMain.Width * 1.28
ufMain.Height = Application.Height - 107

With ufMain.LB1
.Font.Size = 9
.Height = 168
End With

For Each ctrl In ufMain.Controls
ctrl.Height = ctrl.Height * 1.28
ctrl.Top = ctrl.Top * 1.28
ctrl.Width = ctrl.Width * 1.28
ctrl.Left = ctrl.Left * 1.28
Next ctrl

' That's it! Hope it works.
' Let's us know how you fare. Email me
' at darinr@cox.net with questions.
 
Upvote 0

Forum statistics

Threads
1,214,988
Messages
6,122,620
Members
449,092
Latest member
amyap

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top