set userform to full screen.

jdavis9

Active Member
Joined
Mar 8, 2002
Messages
337
Good morning members.

I am trying to set a userform to full screen, and still center the objects contained in the userform.

I am trying to get around the userform not covering the whole screen when the video resolution is changed.

Any Ideas?
 
Code:
Private Sub UserForm_Initialize()

    Application.WindowState = xlMaximized
    Me.Top = Application.Top
    Me.Left = Application.Left
    Me.Width = Application.Width
    Me.Height = Application.Height
    
End Sub

Controls will not automatically move so you will have to set the top and left property of each one to what you want.
 
Upvote 0
Or if you just want to cut to the chase and not bother with moving the controls around, try this:

Private Sub UserForm_Initialize()
With Application
.WindowState = xlMaximized
Zoom = Int(.Width / Me.Width * 100)
Width = .Width
Height = .Height
End With
End Sub
 
Upvote 0
Tom - Thats pretty nice actually. It will enlarge the controlls as well, but they will stay in their same spot.
 
Upvote 0
It gives the illusion of enlarging the controls because of the zoom factor, which at least for me works out as a better tradeoff than alternative screen resolution code.
 
Upvote 0
Very nice.

Toms method is the way I ended up going with. The zoom feature works well for me also. The only problem is you are limited in zoom factor to 100 to 400 so if the form is real small to start with you get a out of range number.

But the fix is easy, just make the form a little larger then the number will be within range. Of course this can be a pain depending on the res the form was created in -vs- the users screen res.

Thanks for the assistance DJR and Tom
 
Upvote 0
Tom -


Thanks for the post. I was just scanning posts when I stumbled upon this. It does work great and I have already implemented it.

Again - Thanks,


Kurt
 
Upvote 0
jdavis9 said:
Very nice.

Toms method is the way I ended up going with. The zoom feature works well for me also. The only problem is you are limited in zoom factor to 100 to 400 so if the form is real small to start with you get a out of range number.

But the fix is easy, just make the form a little larger then the number will be within range. Of course this can be a pain depending on the res the form was created in -vs- the users screen res.

Thanks for the assistance DJR and Tom

You're Welcome :beerchug:

Take Care
 
Upvote 0

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