Article ID: 143345
Article Last Modified on 10/11/2006
' Procedure to display which button was pressed.
Sub WhichButton()
' Assign the calling object to a variable.
ButtonName = Application.Caller
' Display the name of the button that was clicked.
Select Case ButtonName
' NOTE: When you type the name of the button, note that
' Visual Basic is case and space sensitive when comparing
' strings. For example, "Button 6" and "button6" are not the
' same.
Case "Button 6"
MsgBox Application.Caller & " was Clicked"
Case "Button 7"
MsgBox Application.Caller & " was clicked."
Case "Button 8"
MsgBox Application.Caller & " was clicked."
End Select
End Sub
Additional query words: 5.00c XL
Keywords: kbhowto kbprogramming kbcode KB143345