Re: $$Excel-Macros$$ In OnAction macro caller check or parameter

2010-03-18 Thread Erwin Ahlers
Hello, I tried this Application.Caller function but it returned not a string it returned a variant object. So I don't know how to get the button from the variant. I create the button with Set MenuItem = Menu2.Controls.Add(Type:=msoControlButton) MenuItem.Caption = aSheet.C

RE: $$Excel-Macros$$ In OnAction macro caller check or parameter

2010-03-17 Thread Dave Bonallack
Hi, Use the following code line early in your macro: A = Application.Caller A will be the name of the button that called the macro. You can call your buttons by special names, or use a Case statement to sort through all the buttons you have. Or you can get VBA to read the text on the button