Link to home
Start Free TrialLog in
Avatar of Vipin Kumar
Vipin KumarFlag for India

asked on

Display the VBA Userform in Screen Center

Hi,

I want to display my VBA Userform in the screen center even if I change the height and width of the Userform.

For example when I initialize my Userform I have set the value of the property Startupposition to 2-CenterScreen and the height and width of form is set to 50 and 250 respectively. Depending on the value of a combobox in the form the Height and Width of the form changes, but as my form has already initialized in the screen center with height and width of 50 and 250 respectively, if either of height or width increases the form increases it height or width but doesnot center.

I want to achieve a way to center the form everytime it's height or width is changed.

Kindly let me know if anything else is required.

Thanks in advance.
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

Have you set the StartUPPosition Property to 1?

User generated image
Avatar of Vipin Kumar

ASKER

@Roy_Cox,

I have set the Startupposition to 1 but when the height and width of form changes then form is not centered.
ASKER CERTIFIED SOLUTION
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Pleased to help