Finance

Charts

Statistics

Macros

Search

Setting the Location of a Custom Form or UserForm, Excel VBA

 

The initial position of the form is defined by the StartUpPosition property. Valid values are listed in the table below.

StartUpPosition Property Values

Value Description
0 The coordinates of the top-left corner of the form are set using the Top and Left properties
1 Center of the application window
2 Centered on the screen
3 Top-left corner of the screen

For example, the following code sets the form so that its top-left corner is at the point (100, 100):

Private Sub UserForm_Initialize()
    Me.StartUpPosition = 0
    Me.Top = 100
    Me.Left = 100
End Sub
0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx