The Err Object

To obtain information about an error, you use the Err object. This is an intrinsic VBA object with global scope, so you do not need to create an instance of it in your code. When an error occurs, VBA puts information about the error in the Err object's properties. Your error-handling code can query those properties to identify the error. The properties are identified in Table 20.1.

Table 20.1. Properties of the Err object.
PropertyDescription
DescriptionReturns a string describing the error.
HelpContextContains the context identifier for online help related to the error.
HelpFileContains the full path to the help file containing information related to the error.
LastDLLErrorIf the error was generated by a call to a dynamic link library ...

Get Office® XP Development with VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.