Microsoft 365 and Office | Development | Other
Building custom solutions that extend, automate, and integrate Microsoft 365 apps.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Dear All,
by the below Excel VBA code I move an Userform below a TextBox:
Dim FormTitleSize As Double
Dim dblTop As Double
Dim dblLeft As Double
With Me
FormBorderSize = (.Width - .InsideWidth)
FormTitleSize = .Height - (.InsideHeight + FormBorderSize)
dblTop = .Top + .txtID_Request.Top + .Height - .InsideHeight + FormTitleSize
dblLeft = .Left + txtID_Request.Left + .Width - .InsideWidth - FormBorderSize
End With
With frmList
.StartUpPosition = 0
.Top = dblTop
.Left = dblLeft
End With
but I would like to have the Userform aligned with the button indicated by the red arrow as below image:
Any suggestion?
Thanks
Check this expression:
dblLeft = .Left + myButton.Left + myButton.Width + FormBorderSize - frmList.Width
The form should be repositioned when some parts are invisible (off-screen).