CommandButton

M

Mark Wilkins

Hi,

Is there a way of knowing what CommandButton has been
clicked on within a method ? I would like to write a
generic method to process the text on a CommandButton such
as:

Private Sub CommandButton1_Click()
'Display Command Button Text
MsgBox("The button you clicked on
was: "+theCommandButton.Caption

End Sub

There does not seem to be any keywords such as "this"
or "sender" etc.

Thanks

Mark
 
M

Mark Wilkins

I need to write a generic fucntion.

I have a document with some CommandButtons on it. I would
like a function that will work in all command buttons that
does not need to be modified according to the command
button that called it. So if I have two commandbuttons I
want the same code for each but for it to display the
calling commmand buttons caption.
 
K

Kemosabe

I have wanted to do something similar, but it would fire from the
MouseMove event. In this case, it would not necessarily be the active
control. (It would not necessarily be a CommandButton, either,
possibly a checkbox or optionbutton). Any ideas? Thanks.
 

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