Module, create toolbar/handle clicks

N

nullGumby

Using Excel 2003, I'm trying to write a module that will dynamically
create a toolbar and buttons when the workbook loads, destroy the
toolbar when it's closed, and handle the clicking on the buttons on
it.

I have already written all the code for creating a toolbar and
destroying the toolbar.

What I'm struggling with is a way to handle the clicking of the command
buttons on the toolbar. I know there's an "onAction" property that I
can point to a macro, but I'd like my module to have a procedure called
"HandleCMDClick" or something, and be able to handle the clicking of any
button.

I've already tried including a parameter at the end of the "onAction"
property, i.e. "modToolbar.HandleCMDClick("Button1")", but that doesn't
work; it doesn't recognize that as a call to "HandleCMDClick". Is there
a way, in the "HandleCMDClick" procedure, that I can tell which button
was clicked?

Anyone have any insight they can lend? Thanks much.
 
T

Tom Ogilvy

use
Commandbars.ActionControl

to get a reference to the control triggering the action.
 

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