VBA - how to make a Button refer to itself in its own click event in a generic way

I am wondering if there is a way a CommandButton on a VBA userForm can refer to itself in its own click event.
To clarify my question, I have a button named thisButton on my form. In its click event I would like to display a message box that will display its own caption in a message box. I can currently do this as I show in my code sample by saying thisButton.Caption but this means that if I want to do the same in the click event of another button named thatButton, then I have to say thatButton.Caption.
That is each button has to use its own name in the code to refer to itself.

In .NET applications the ClickEvent of every button has a parameter named sender that a button can use to refer to itself. I am wondering if such a thing is possible in VBA.
Thank you for your help.

Private Sub thisButton_Click()

MsgBox thisButton.Caption

End Sub

Private Sub thatButton_Click()

MsgBox thatButton.Caption

End Sub

' I would like to do this in the following way, if at all that kind of thing is possible

Private Sub thisButton_Click()
'' assuming sender here refers to the button that is being clicked
MsgBox sender.Caption

End Sub

Private Sub thatButton_Click()
' assuming sender here refers to the button that is being clicked
MsgBox sender.Caption

End Sub

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:

MsgBox ActiveControl.Name

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FaheemAhmadGulAuthor Commented:
Many thanks!
Greatly appreciated.
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017
FaheemAhmadGulAuthor Commented:
Thank you. I will certainly look at these.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.