Share via

UserForm Start Position

Anonymous
2012-01-10T15:47:51+00:00

Hi all,

I'm writing those lines to ask help with UserForms start position.

When I create a new UserForm I have on Properties Box and on Position, the followings properties:

Height

Left

StartUpPosition

Top

Width

The Height and Width defines the size of UserForm

The StartUpPosition defines the way as windows permite or not, change the position by user

The Left and Top defines de distance of left and of top to our UserForm

I want put the UserForm on Bottom or on Right of screen and for that I must know the maximum height and maximum width of excel's window which depends of monitor resolution.

With those variables, I could to do on Initializing UserForm something like :

UserForm1.Position.Top = maximum_height - UserForm1.Position.Height

and to put the UserForm aligned with right screen side, like:

UserForm1.Position.Left = maximum_width - UserForm1.Position.width

Someone could help me?

Diogo

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2012-01-10T16:10:40+00:00

Try

Private Sub UserForm_Initialize()

    Me.Top = Application.Top + Application.Height - Me.Height

    Me.Left = Application.Left + Application.Width - Me.Width

End Sub

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2012-01-10T16:30:59+00:00

    Thanks, it is perfect!

    Now it is possible put the UserFom on bottom and centered horizontaly.

    Diogo

    Was this answer helpful?

    0 comments No comments