D
Doug Glancy
I'm trying to write a CommandbarButton OnAction sub that uses
Application.Caller to toggle the state of the button that called it, even if
it's down a couple levels of submenus.
So if I have a toolbar called "toolbar" and a button called "button" that's
in a submenu I'd like to have the .OnAction of "button" be "toggle_button".
Since, as far as I can tell, an onaction macro doesn't take arguments (can
it?), I'd hard-code "toolbar" in the macro and use (I guess)
application.caller to identify the control.
I've tried a few things: "application.parent" isn't valid, unfortunately, or
I could work my way back up through the menus. I've struggled with a
recursive function and a bunch of nested loops, but it's ugly, and I'm
hoping maybe somebody already has a good solution for this.
Does that make any sense? Of course, I don't really care if the solution
involves application.caller or not.
Thanks in advance,
Doug
Application.Caller to toggle the state of the button that called it, even if
it's down a couple levels of submenus.
So if I have a toolbar called "toolbar" and a button called "button" that's
in a submenu I'd like to have the .OnAction of "button" be "toggle_button".
Since, as far as I can tell, an onaction macro doesn't take arguments (can
it?), I'd hard-code "toolbar" in the macro and use (I guess)
application.caller to identify the control.
I've tried a few things: "application.parent" isn't valid, unfortunately, or
I could work my way back up through the menus. I've struggled with a
recursive function and a bunch of nested loops, but it's ugly, and I'm
hoping maybe somebody already has a good solution for this.
Does that make any sense? Of course, I don't really care if the solution
involves application.caller or not.
Thanks in advance,
Doug