In just a few easy lines you can a have a easy, error proof error handler for you apps! Plus, NO APIs!
Original Author: Erik Hagendorn
Code
''''IN MODULE!''''
Sub ErrHandler
ErrDesc = Err.Description
ErrNum = Err.Number
Beep
MsgBox "Error number " & ErrNum & " has occured because: " &_
ErrDesc, vbCritical, "Error"
Exit Sub
'Edit the msgbox all ya want to make it fit your needs
End Sub
'Ok, now to make my error handler work you need to
'add this right under the Sub...Examle:
Private Sub Command1_Click ()
'Now Here Is the code you need to add:
On Error Goto ErrHandle:
'Then put ALL your code for this Sub in as you would
'as usual, then at the end type:
ErrHandle:
Call ErrHandler
'AND THATS IT!
End Sub