View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Zone Zone is offline
external usenet poster
 
Posts: 269
Default How can I Center a Dialog Box each time a user opens it?

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

Bandit wrote:
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?