Share via


Returning Information about an Error

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

There are two ways of returning information about an error. The traditional Microsoft® Visual Basic® for Applications (VBA) style is to raise the error in a procedure, either by leaving out an error handler so that the VBA error is returned to the calling procedure or by using the Raise method of the Err object. The other way to return error information uses the Windows application programming interface (API) style, where an error value is assigned to one of the procedure's parameters.

If you use the API style of returning error information, the calling procedure must use in-line error handling to identify whether an error has occurred. If you use the traditional VBA style, the calling procedure can use either in-line error handling or an error handler. Neither way is inherently better than the other. The important point to remember is to adopt a style that works for you and to use it consistently.

See Also

Writing Error-Free Code | Design-Time Tools | Run-Time Tools | Script Debugging Tools | Basic Error Handling | Automating Error Handling | The VBA Err Object | The ADO Error Object and Errors Collection | Error Handling in Class Modules | Handling Script Errors