Custom Error Handlers Custom Error Handlers

Custom Error Handlers allows you to create your own error handlers to suit your own requirements. The error handlers created are used by the Procedure Builder, Auto Coder, Proc. Recoder and Control Coder add-ins. There is a limit of twelve custom error handlers.

Custom Error Creation

Custom Error Creation

To create a new error handler enter the name for it and click 'Add'. The name is then inserted into the 'Errors' DropDown and focus set to the 'Handler Code' TextBox. Enter the code for the error handler. If necessary you can add 'Standard Elements' to the code these are listed and described below: -

When 'Module Name' is used what is actually written out to the module depends on the modules type. If it's a form or class then the code

TypeName(Me)

is used. This will return the name of module at runtime, using this method means that the error handler doesn't have to be updated to reflect any changes in the modules name. If the module is a standard module the constant

VB_MODULE_NAME

is used. If the constant hasn't been created yet then it's created, for example

Private Const VB_MODULE_NAME = ".modSortRoutines" '* Used in Error Handling

, is written to the General Declarations area of the module. If the name of the module is subsequently changed then only one location needs to be updated in code.

To add a standard element, position the cursor where you want it and click the 'Insert' CommandButton.

When you have finished click the 'Save' CommandButton to store the error handler to the registry. The 'Clear' CommandButton clears the code.

To remove error handlers no longer required select the error in the errors DropDown and click the 'Delete' CommandButton.

When new error handlers are created they will be available immediately in the Procedure Builder, Auto Coder and Control Coder add-ins. However, they will be available in the Proc. Recoder add-in when either you next open VB or reload the add-in suite from the Add-in Manager

Custom Error Handlers is available for display in the menu and/or toolbar.

A Custom Error in Proc Recoder

A Custom Error in Proc Recoder.