View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Center Userform Controls

Just do something like

With Me
.cmdOK.Left = .Width \ 2 - .cmdOK.Width \ 2
.cmdQuit.Left = .Width \ 2 - .cmdQuit.Width \ 2
End With


in the form activate event

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Shawn" wrote in message
...
I am using the following code to make the userform fill the entire screen:

Private mlAppWindowState As Long
Private Sub UserForm_Initialize()
With Application
mlAppWindowState = .WindowState
.WindowState = xlMaximized
Me.Move .Left, .Top, .Width, .Height
End With
End Sub
Private Sub UserForm_Terminate()
Application.WindowState = mlAppWindowState
End Sub


What I need is VBA to center the userform controls. Maybe I could put the
controls inside a frame and I just need to the frame to center. I am not
sure. But I need VBA to position the controls. Can someone get me
started?


--
Thanks
Shawn