Similar to "Need to know what is selected"
Macros won't know what caused them to run unless you tell them.
I Dim a string variable to store what-was-clicked information. For
instance, in the Click event handler for a command button I would do
something like:
Private Sub SomeButton_Click()
Caller="SomeButton"
DoSomething
End Sub
The Sub DoSomething would probably have a Select Case statement that
would test the variable Caller to determine what caused it to run.
You can use an integer variable as well. It's just easier to tell what
happened if you see "OKButton" rather than, say, "13".
In short, whenever you call a macro, tell your Caller variable what
made you call the code.
|