Please read the faq "Error Handling" by CasperTFG first, this is only meant as an additional note:
I use the "app.logEvent" call for the most part when handling errors. This writes a log to the application event viewer in the control panel.
Syntax:
=======
App.LogEvent vbCrLf & Err.Description & vbCrLf _
& Err.Number & vbCrLf & App.EXEName & " your sub name"
Notes:
======
err.Description = the vb error description
err.Number = the error number
app.exename = the name of my program
vbCrlf = carraige return & line feed, to give me a new line
You can also add a number ie 1,2,3 to the call to indicate the severity of the error in the event viewer.
Example:
========
Sub nameOFSUB '*** could be a function
on error goto errorhandler
'*** code of the sub
exit sub '*** could be a function
errorhandler:
App.LogEvent vbCrLf & Err.Description & vbCrLf _
& Err.Number & vbCrLf & App.EXEName & " your sub name here"
'***here use any of the following
err.clear
resume next
'*** or your bail out code
End Sub
===========================
Jonathan Galpin MCSD +++¼
www.iqzero.net
because software should be easy to use
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.