View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] NoSpam@aol.com is offline
external usenet poster
 
Posts: 142
Default Can a Sub/Function print the names of its callers?

If I detect an error in a Sub/Function, I would like to be able to print
the sequence of callers. Line numbers would be great too if that is
possible.

Example:

sub Main()
call Sub
end sub

sub Sub1()
call sub2(3)
end sub

Sub Sub2(n as long)
if n 2 then
'Code to print
' Sub 2 called with value n
' from Sub1 at line 2
' from Main at line 2
end
end if
end sub