I would like to know if its possible, when an error occurs, to get the name of the sub that contains the code that generated the error?
Also, if its possible to get the line of code would be great too!
I would like to use the info to display it in messagebox when an error occurs.
Something like:
Also, if its possible to get the line of code would be great too!
I would like to use the info to display it in messagebox when an error occurs.
Something like:
Code:
on error goto errhandler
[COLOR=sienna]'some code that generates an error[/COLOR]
errhandler:
dim myerr as classmyerr
set myerr = new classmyerr
msgbox "error while running sub: " &[COLOR=green] [I]myerr.sub 'get name of sub where error occured [COLOR=black]_[/COLOR][/I][/COLOR]
& vbcrlf & "at line: " & [I][COLOR=green]myerr.line 'get line number where error occurred[/COLOR][/I]