PDA

View Full Version : Where called from



mud2
02-02-2011, 06:12 PM
Hello, it's been a Looong time!

I have several functions...say a, b, c, d...
each one calls the same function...say X. How do I get function X to know which function called it...without putting the specific calling function's name in the call to function X ?
Thanks!

CreganTur
02-03-2011, 06:21 AM
Well since VBA doesn't have robust error handling and doesn't provide stack tracing your only option is to build something to handle this.

The wrox book Expert Access 2007 Programming has a section that shows you how to build an error handling class that defines a rudimentary stack trace and can tell you the name of calling procedures. It's way too much code for me to replciate here.

orange
02-03-2011, 04:18 PM
There is a free utility called MZTools that has many functions/features
including a ProcedureCallers.

It has many worthwhile features and is free.

You should get the version specific to vba

Mztools for VBA

http://www.mztools.com/index.aspx

L@ja
02-12-2011, 10:02 AM
hi,
possible the following?

sub func_x(caller as string)
'caller variant have your answer
ParentFuncName=caller
'...
end sub

sub func_a()
'old version
'call func_x
'new version
call func_x("a")
'...etc
end sub