Trap errors globally

Trap errors globally

Anonymous
Not applicable
191 Views
1 Reply
Message 1 of 2

Trap errors globally

Anonymous
Not applicable
Let me explain what I'm going for here.
I'm kinda "in charge" when it comes to any VBA problems/solutions, so i'm looking for a way to write a

On Error GoTo "this Sub that I wrote" anywhere in a module, that will send a email to me including the error description, number, and what sub or function was being ran when this happened.

Is there a way to do this without writing a line of code calling this up when an error occurs? Maybe something where the public Const & Vars are declared.

Be kind if this seems ridiculous.
0 Likes
192 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
In all Sub/Functions that may produce errors:
Sub SomeName()
On Error GoTo ErrorHandler
...
Exit Sub
ErrorHandler:
Call ErrorHandlerSub
End Sub

In public module:
Public Sub ErrorHandlerSub()
...
End Sub

--
John Goodfellow
irtfnm
use john at goodfellowassoc dot com


wrote in message news:4862291@discussion.autodesk.com...
Let me explain what I'm going for here.
I'm kinda "in charge" when it comes to any VBA problems/solutions, so i'm
looking for a way to write a

On Error GoTo "this Sub that I wrote" anywhere in a module, that will send a
email to me including the error description, number, and what sub or
function was being ran when this happened.

Is there a way to do this without writing a line of code calling this up
when an error occurs? Maybe something where the public Const & Vars are
declared.

Be kind if this seems ridiculous.
0 Likes