Thread: Calling macro?
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Calling macro?

On Mar 13, 1:45*pm, "Charlotte E" wrote:
But, is it possible in the called macro ("AnotherMacro")
to get the name of the macro, which called "AnotherMacro"?


If you put a breakpoint in the called macro, you can press ctrl+L or
click View Call Stack to see not only who called the current macro,
but the complete history of calls.

(I don't know if there is a limit to the depth of the call stack that
is viewable.)

If your intent is to determine this programmatically -- for example,
to do one thing if the caller is X, but to do another thing if the
caller is Y -- there certain __can__ be a mechanism for doing that, at
least in theory.

But I do not know if VBA provides a method for doing that, or if a
kernel dll provides an API (function) for doing that.

(I have implemented such functions for other languages on other
operation systems, so I know it is doable.)