How can I Center a Dialog Box each time a user opens it?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a custom dialog box with dropdrowns etc used to select options.
Each time you click the command buttion that shows the dialog box the box
moves towards the upper left corner of the worksheet? How can I center the
dialog each time it is shown?. Are there methods to control the position of a
dialog using VBA or other means?
 
Bandit, if you're talking about a userform, follow these steps:
1. Display the userform in the VBA editor
2. Display the userform properties.
3. In the userform properties, set Startup Position to manual.
4. Copy this code and paste to your userform module:

Private Sub UserForm_Initialize()
Me.Left = Application.Width / 2 - Me.Width / 2
Me.Top = Application.Height / 2 - Me.Height / 2
End Sub

James
 

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

Back
Top