Name
Err.Raise Method
Class
Microsoft.VisualBasic.ErrObject
Syntax
Err.Raise(number, source, description, _helpfile, helpcontext)
-
number(required; Long integer) A numeric identifier of the particular error
-
source(optional; String) The name of the object or application responsible for generating the error
-
description(optional; String) A useful description of the error
-
helpfile(optional; String) The fully qualified path of a Microsoft Windows Help file containing help or reference material about the error
-
helpcontext(optional; Long) The context ID within
helpfile
Description
Generates a runtime error
Rules at a Glance
To use the Err.Raise method, you must specify an error number.
If you supply any of the
number,source,description,helpfile, andhelpcontextarguments when you call the Err.Raise method, they are supplied as values to the Number, Source, Description, HelpFile, and HelpContext properties, respectively. Refer to the entries for the individual properties for full descriptions of and rules for each property.The
numberargument is a Long integer that identifies the nature of the error. Visual Basic errors (both Visual Basic-defined and user-defined errors) are in the range 0-65535. The range 0-512 is reserved for system errors; the range 513-65535 is available for user-defined errors. When setting the Number property to your own error code in a class module, you add your error-code number to thevbObjectErrorconstant.
Programming Tips and Gotchas
The Err.Raise method replaces ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access