StartUpPosition property
Returns or sets a value specifying the position of a UserForm when it first appears. Use one of four settings for StartUpPosition.
Setting | Value | Description |
---|---|---|
Manual | 0 | No initial setting specified. |
CenterOwner | 1 | Center on the item to which the UserForm belongs. |
CenterScreen | 2 | Center on the whole screen. |
WindowsDefault | 3 | Position in upper-left corner of screen. |
Remarks
You can set the StartUpPosition property programmatically or from the Properties window.
Example
The following example uses the Load statement and the Show method in UserForm1's Click event to load UserForm2 with the StartUpPosition property set to 3 (the Windows default position). The Show method then makes UserForm2 visible.
Private Sub UserForm_Click()
Load UserForm2
UserForm2.StartUpPosition = 3
UserForm2.Show
End Sub
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for