View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Obtain Name of Function or Sub

Just for ideas -

Sub test()
Dim v
On Error GoTo errH
v = "a" ' mismatch
' v = 1 ' div by zero
test2 v
Exit Sub
errH:
MsgBox Err.Description
End Sub

Sub test2(v)
On Error GoTo errH
10
20
30 test3 v
40
Exit Sub
errH:
s = "test2, line:" & Erl & vbCr & Err.Description
Err.Raise 12345, , s
End Sub

Sub test3(v)
On Error GoTo errH
10
20
30 v = v / 0
40
Exit Sub
errH:
s = "test3, line:" & Erl & vbCr & Err.Description
Err.Raise 12345, , s
End Sub

Regards,
Peter T

"Roger Smith" wrote in message
...
Hi Experts

I would like to include the name of the current function or subroutine in

my
error handler output. Is there any property that will provide the name or
context of the current point in the call chain?

Thanks much,

Roger