View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Umlas Bob Umlas is offline
external usenet poster
 
Posts: 301
Default name of calling routine

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

"Smallweed" wrote in message
...
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.