name of calling routine

S

Smallweed

I suspect the answer is "you can't" but does anyone know of a way to return
the name of the routine that's called a function? Failing that, some generic
code that returns the name of the current sub or function? I'm just writing
a universal error routine and it's a pain having to send the calling
routine's name by hand each time.
 
B

Bob Umlas

Your latter comment implies you don't like:
Sub RoutineA()
'...
CallFunctionX RealParameter,"RoutineA"
'...
End Sub
Function CallFunctionX(WhatIneed,WhoCalledMe as String)
'...
'WhoCalledMe is the routine who called me in
'...
End Function
Sub AnotherGuy()
'...
CallFunctionX RealParameter,"AnotherGuy"
'...
End Sub

But aside from numbering every line and using the erl (line # function), I
don't know of a way (would be a nice thing to have -- some way to easily to
invoke the Call Stack)

Bob Umlas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top