QuickStart: How it works



 Sept 2010: v2 of VBA Global Error Handler is now available vbWatchdog (no DLLs!)

Overview

The Global Error Handler installs a small callback hook into the VBE6 debugger.  From then on, when an error occurs, our hook function first parses the error and passes details about the error on to a procedure that you have declared in your VBA or VB6 code.

Whether you want to just log errors to a simple text file, implement your own professional error dialogs, or some other advanced feature like ignoring 'On Error Resume Next' statements for debugging purposes - all this is easily achievable.

Furthermore, one of the main features of our Global Error Handler is that we provide you with full details of where the error occurred in your source code - even if your project is fully compiled (e.g. Access MDE formats or VB6 exe formats).

Flow Diagram

Flow Diagram

Flow Diagram Example

(An example of the new customizable error dialog using the new features of ErrEx)

Features (exposed programmatically)

  • The name of the procedure that caused the error (see ErrEx.SourceProcedure)
  • The name of the module where the procedure that caused the error resides (see ErrEx.SourceModule)
  • The name of the VBA project where the procedure that caused the error resides (see ErrEx.SourceProject)
  • The line number in the procedure that caused the error (with automatic line numbering)
  • The source code line that caused the error (based on automatic line numbering)
  • The complete call stack details so that you can determine how your procedure got called (the route that was taken to get there)
  • Professional, re-usable Vista-style error dialogs ready for your use. Or design your own Access form if you wish!
  • NEW: (VBA only) VariablesInspector class for enumerating through the local variables in the procedure of error (and any procedure in the callstack). With this you can also read the live values of those variables and log everything to your log table or file.

It's important to understand that once your global error handler is enabled, every error that occurs in your code now passes through your custom global error handler routine.

In other words, even if you specify 'On Error Resume Next' in your local procedure code, your global error handler will still be called. From within your global error handling routine, you can then decide what states of local error handling you wish to listen to or ignore. For example, most developers choose to ignore errors that occur when 'On Error Resume Next' has been specified in your local procedure.

See the Sample.mdb for a real example of implementing your global error handler.