Align the form to the top left

G

Guest

How to align the form to the top left? Right now when the form is
initialized, it is centrally aligned.
 
G

Guest

Set the startup position in the initialize event.

Private Sub UserForm_Initialize()
UserForm1.StartUpPosition = 3
End Sub
 
G

Guest

Private Sub UserForm_Initialize()
Me.StartUpPosition = 0
Me.Left = 0
Me.Top = 0
End Sub
 
G

Guest

I should have mentioned my use of 3. In VB (not VBA) there are constants for
the start up position. Here they are

vbStartUpManual 0 No initial setting specified.
vbStartUpOwner 1 Center on the item to which the UserForm belongs.
vbStartUpScreen 2 Center on the whole screen.
vbStartUpWindowsDefault 3 Position in upper-left corner of screen.

VBA does not have the same constants but you can declare them if you wish...
I just used 3...
 
G

Guest

Thanks. It works.

I've also found that I can select "3 - Windows Default" under
"StartUpPosition" on "Properties" of the form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top