Toolbar Button Click - Identify VBA Macro Command

Toolbar Button Click - Identify VBA Macro Command

Anonymous
Not applicable
853 Views
1 Reply
Message 1 of 2

Toolbar Button Click - Identify VBA Macro Command

Anonymous
Not applicable

For logging purposes I need to acquire the macro data string when a user clicks a toolbar button (not a ribbon), when the command is VBARUN.

 

The event handler CommandWillStart event argument gives you the command name, but nothing more.

When the command name is VBARUN I need to know which macro is being called.

 

For example, in the CUI, if the macro string is:

 

^C^C-vbarun;fred;

 

You can't get the value 'fred' in the event handler.

 

I don't know how to make the connection between the button the user clicked and the macro string 'fred', 'mary' or whatever it is.

 

Thanks,

 

Randy

 

0 Likes
854 Views
1 Reply
Reply (1)
Message 2 of 2

ActivistInvestor
Mentor
Mentor

There might be a way to do that using VBE (Visual Basic Extensibility), but my memory of anything related to VBA has faded, along with the tool.

 

Instead, you may be able to either redefine VBARUN (in LISP), or just define another command (in LISP), that prompts for the macro to run, logs it, and then issues the real VBARUN command to execute it. If you define a differently-named command, you would then replace all use of VBARUN in any menu macros with the name of the replacement command.


@Anonymous wrote:

For logging purposes I need to acquire the macro data string when a user clicks a toolbar button (not a ribbon), when the command is VBARUN.

 

The event handler CommandWillStart event argument gives you the command name, but nothing more.

When the command name is VBARUN I need to know which macro is being called.

 

For example, in the CUI, if the macro string is:

 

^C^C-vbarun;fred;

 

You can't get the value 'fred' in the event handler.

 

I don't know how to make the connection between the button the user clicked and the macro string 'fred', 'mary' or whatever it is.

 

Thanks,

 

Randy

 


 

 

 

 

0 Likes