Get the Name of the Calling Procedure

SammyB
StarLounger
Posts: 57
Joined: 04 Mar 2010, 16:32

Get the Name of the Calling Procedure

Post by SammyB »

I don't think that this can be done, but I am just checking.

In Excel VBA at the end of my macros that create a report worksheet, I would like to create a subroutine in VBA the adds a "signature" to the bottom of the report worksheet. I would like to include the name of the calling macro in the signature. Obviously, I can just pass this name as an input parameter, but I was wondering if there was a way to get the name in code. This would also be useful to use in error messages.

User avatar
HansV
Administrator
Posts: 75751
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Get the Name of the Calling Procedure

Post by HansV »

As far as I know, there is no way to do that except explicitly passing the name.
Regards,
Hans

SammyB
StarLounger
Posts: 57
Joined: 04 Mar 2010, 16:32

Re: Get the Name of the Calling Procedure

Post by SammyB »

Thanks, Hans, just wanted to check!

PJ_in_FL
5StarLounger
Posts: 1008
Joined: 21 Jan 2011, 16:51
Location: Florida

Re: Get the Name of the Calling Procedure

Post by PJ_in_FL »

So there is no way to access the Call Stack programmatically?
PJ in (usually sunny) FL

User avatar
HansV
Administrator
Posts: 75751
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Get the Name of the Calling Procedure

Post by HansV »

No, there isn't. But you can create your own call stack: Managing a programmatically accessible stack trace.
Regards,
Hans