Setting Up an Error Handler

Building high-quality, robust applications requires the use of error handlers. These handlers are often boiler-plate code, so it is useful to define them once and then use that code repeatedly.

VbaPrime will detect that you have started an error handler and then automatically add the remainder of that handler for you. VbaPrime will then place the cursor in the optimum position for you to continue coding.

Defining your Error Handler

To define your error handler, use the the VbaPrime Settings Window.

  • From the menu bar, navigate to VbaPrime-Options-Settings
  • In the Settings window, select the Error Handler tag. You should see something like the following:
    Settings Window showing the Error Handler
    Settings Window showing the Error Handler

  • Edit the Error Handler to your own requirements. The tags inside the % signs are Replaceable Tags and have special meaning.
  • Click the OK button to apply your changes.

Replaceable Tags

You can insert replaceable tags into your error handler. VbaPrime will use these tags in a context-sensitive manner, so that the error handler fits your requirements.

  • %method_type% - will be replaced by Sub or Function, depending on which sort of method the error handler is added to.
  • %cursor% - specifies the exact position where VbaPrime will place the cursor after finishing the auto-complete.