How do you add arguments to an OnAction event?

J

Jason

I'd like to add an argument to an Onaction sub, which is
associated with a button? Can I?

Sub DoThis(strArg as String)
....
End Sub

Dim b as CommandBarButton
b.OnAction ="DoThis" *** THEN WHAT ***


Thanks
 
J

Jake Marx

Hi Jason,

Yes, you can do this. You can add the string to the Parameter property of
the CommandBarButton. Then, in your subroutine specified by the OnAction
property, you can check the Parameter property of the "clicked" button with
Application.CommandBars.ActionControl.Parameter.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
T

Tom Ogilvy

Note that this undocumented feature appears to not be supported in xl2002.
I believe it may have problems in the latest service release of xl2000 as
well. At least that is what I recall has been reported here.
 
T

Tim Zych

Didn't know that. Thanks for the update.
-----Original Message-----
Note that this undocumented feature appears to not be supported in xl2002.
I believe it may have problems in the latest service release of xl2000 as
well. At least that is what I recall has been reported here.

--
Regards,
Tom Ogilvy




.
 

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