FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,368
- Office Version
- 365
- 2016
- Platform
- Windows
I currently use the code below to center the userform in the center of the screen. All works good.
I have many userforms and instead of duplicating this code in the Sub to open every userform, can I call it somehow?
I'm just not sure how I would pass the name of the userform to the call to retrieve the position details.
Code:
With UserForm1
.StartUpPosition = 0
.Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
.Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
.Show
End With
I have many userforms and instead of duplicating this code in the Sub to open every userform, can I call it somehow?
I'm just not sure how I would pass the name of the userform to the call to retrieve the position details.