Share via


The VBA Err Object

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.

When an error occurs, Microsoft® Visual Basic® for Applications (VBA) uses the Err object to store information about that error. The Err object can only contain information about one error at a time. Each time an error occurs, any existing information in the Err object is replaced with information about the new error.

The properties of the Err object contain information such as the error number, description, and source. The Err object's Raise method is used to generate errors, and its Clear method is used to remove any existing error information.

For more information about the VBA Err object, search the Visual Basic for Applications Reference Help index for "Err object."

See Also

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