Is there a way tell tell what the .ID of the button was that started a macro?
I have several toolbar buttons running the same code, doing slightly
different things determined by their .ID

Re: Identifying the button that activated the macro by Helmut

Helmut
Fri Feb 10 08:43:38 CST 2006

Hi Charlie,

I think that this is the question for:
"What code is being executed right now?"

I don't know of a way except
declaring in each macro a string with the name of that macro.

Then you can check, which button has
an onaction-property that equals the name of the macro.
Where the name, it seems, must include the module.

By the way, you can execute different code
for the same button by using the API-function "shiftstate".
So that "shift-button" would do something different
from "control-button" etc...

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"






Re: Identifying the button that activated the macro by Tony

Tony
Sat Feb 11 10:05:16 CST 2006

CommandBars.ActionControl

will give you a reference to the toolbar button, if that is how your nacro
was invoked. You can pick up it's ID or any other property from there,

--
Enjoy,
Tony


"Charlie" <Charlie@discussions.microsoft.com> wrote in message
news:A73320AA-D435-4EC7-BA7D-D8ACBC2177BF@microsoft.com...
> Is there a way tell tell what the .ID of the button was that started a
macro?
> I have several toolbar buttons running the same code, doing slightly
> different things determined by their .ID