after click a button(commandbutton), getting the button name

R

RyanH

You just need to use the caption property of the command button.

MsgBox "this button name is " & btn.Caption
 
X

x taol

RyanH!
Surely, I already know it.
I want to know caption of the command button, when I click the button
the moment
namely,,,,,
1.click the button
2.It seems the name of the button in the message box.

*** Sent via Developersdex http://www.developersdex.com ***
 
K

Ker_01

If you need the whole sub, this should give you a starting point. Be sure to
change the CommandButton1 if you are using this with a button of a different
name.

Private Sub CommandButton1_Click()
MsgBox CommandButton1.Caption
MsgBox CommandButton1.Name
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top