Interface IStdErrClass
MS-VBAL 6.1.3.2 Err Class
[StdLibClass("ErrObject", IsCreatable = false)]
public interface IStdErrClass
Remarks
Formalizes the public interface of the ErrObject class, whose sole instance is the
error object: its properties and methods reflect and control the error state of the active
VBA environment, and so are backed by the session's own error state rather than by per-instance
storage.
👉 The class is named ErrObject, and its instance is reached through the Err function of
the Information module (Err()). MS-VBAL describes the same
arrangement as "a global class module with a default instance variable" named Err, which is
what a bare Err resolving to the error object looks like from source; a zero-argument function
of a promoted standard module produces exactly that, and leaves ErrObject nameable in an
As clause the way MS-VBA has it. Not creatable: New ErrObject names nothing.
Methods
Clear()
Resets all properties of the error object to their default values.
RuntimeSemanticsEvaluationResult Clear()
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
This method is invoked by the following statement semantics:
- MS-VBAL 5.4.4.2
Resumestatement - MS-VBAL 5.4.2.17
Exit Substatement - MS-VBAL 5.4.2.18
Exit Functionstatement - MS-VBAL 5.4.2.19
Exit Propertystatement - MS-VBAL 5.4.4.1
On Errorstatement
Description()
MS-VBAL 6.1.3.2.2.1 Description Gets a VBStringValue containing a description of the error.
[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBStringValue> Description()
Returns
- RuntimeSemanticsEvaluationResult<VBStringValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Description(VBStringValue)
MS-VBAL 6.1.3.2.2.1 Description Sets the description of the error.
[StdLibMember(null, Kind = StdLibMemberKind.PropertyLet)]
RuntimeSemanticsEvaluationResult Description(VBStringValue value)
Parameters
valueVBStringValueA VBStringValue containing a description of the error.
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
HelpContext()
MS-VBAL 6.1.3.2.2.2 HelpContext Gets a VBLongValue containing the HelpContextID of the error.
[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBLongValue> HelpContext()
Returns
- RuntimeSemanticsEvaluationResult<VBLongValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
ℹ️ Unsupported legacy proprietary Microsoft help system. This property is out of scope of this implementation.
HelpContext(VBLongValue)
MS-VBAL 6.1.3.2.2.2 HelpContext Sets the HelpContextID of the error.
[StdLibMember(null, Kind = StdLibMemberKind.PropertyLet)]
RuntimeSemanticsEvaluationResult HelpContext(VBLongValue value)
Parameters
valueVBLongValueA VBLongValue containing the help context ID value.
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
ℹ️ Unsupported legacy proprietary Microsoft help system. This property is out of scope of this implementation.
HelpFile()
MS-VBAL 6.1.3.2.2.3 HelpFile Gets a VBStringValue containing the HelpFile of the error.
[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBStringValue> HelpFile()
Returns
- RuntimeSemanticsEvaluationResult<VBStringValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
ℹ️ Unsupported legacy proprietary Microsoft help system. This property is out of scope of this implementation.
HelpFile(VBStringValue)
MS-VBAL 6.1.3.2.2.3 HelpFile Sets the HelpFile of the error.
[StdLibMember(null, Kind = StdLibMemberKind.PropertyLet)]
RuntimeSemanticsEvaluationResult HelpFile(VBStringValue value)
Parameters
valueVBStringValueA VBStringValue containing the help file value.
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
ℹ️ Unsupported legacy proprietary Microsoft help system. This property is out of scope of this implementation.
LastDllError()
MS-VBAL 6.1.3.2.2.4 LastDllError Gets a VBLongValue containing a system error code produced by a call to a dynamic-link library (DLL).
[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBLongValue> LastDllError()
Returns
- RuntimeSemanticsEvaluationResult<VBLongValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
👉 Applies only to DLL calls made from VBA code. No error is raised when the LastDllError property is set (internally: this property is read-only).
Number()
MS-VBAL 6.1.3.2.2.5 Number Gets a VBLongValue containing an error code.
[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBLongValue> Number()
Returns
- RuntimeSemanticsEvaluationResult<VBLongValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
👉 Default member: this member is invoked by VBObjectType implicit let-coercion semantics.
Number(VBLongValue)
MS-VBAL 6.1.3.2.2.5 Number Sets a VBLongValue containing an error code.
[StdLibMember(null, Kind = StdLibMemberKind.PropertyLet)]
RuntimeSemanticsEvaluationResult Number(VBLongValue value)
Parameters
valueVBLongValueA VBLongValue containing the error code.
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Raise(VBLongValue, VBVariantValue?, VBVariantValue?, VBVariantValue?, VBVariantValue?)
Generates a run-time error.
RuntimeSemanticsEvaluationResult Raise(VBLongValue number, VBVariantValue? source = null, VBVariantValue? description = null, VBVariantValue? helpFile = null, VBVariantValue? helpContext = null)
Parameters
numberVBLongValueA VBLongValue that encodes the nature of the error.
sourceVBVariantValueA VBStringValue expression naming the object or application that generated the error. When setting this property for a class, use the form "project.class".
Optional: uses the current workspace application name unless specified otherwise.descriptionVBVariantValueA VBStringValue expression describing the error.
Optional: unspecified, the description theErrorfunction would return fornumberis used, or "Application-defined or object-defined error" when it names no VBA run-time error.helpFileVBVariantValueℹ️ Unsupported legacy proprietary Microsoft help system. This parameter is out of scope of this implementation.
helpContextVBVariantValueℹ️ Unsupported legacy proprietary Microsoft help system. This parameter is out of scope of this implementation.
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
An argument that is not specified takes the error object's current property setting, unless that
has been cleared — so Err.Raise given only a Number re-raises with whatever
Source and Description are already set.
Source()
MS-VBAL 6.1.3.2.2.6 Source Gets a VBStringValue naming the object or application that originally generated the error.
[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBStringValue> Source()
Returns
- RuntimeSemanticsEvaluationResult<VBStringValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Source(VBStringValue)
MS-VBAL 6.1.3.2.2.6 Source Sets the name of the object or application that originally generated the error.
[StdLibMember(null, Kind = StdLibMemberKind.PropertyLet)]
RuntimeSemanticsEvaluationResult Source(VBStringValue value)
Parameters
valueVBStringValueA VBStringValue naming the object or application.
Returns
- RuntimeSemanticsEvaluationResult
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
StackTrace()
🎯 RD-VBAL Gets the call stack the current error was raised on, innermost activation first — one indented line per activation, separated by vbCrLf.
[StdLibMember(null, Kind = StdLibMemberKind.PropertyGet)]
RuntimeSemanticsEvaluationResult<VBStringValue> StackTrace()
Returns
- RuntimeSemanticsEvaluationResult<VBStringValue>
A RuntimeSemanticsEvaluationResult object encapsulating the result of the successful operation, or the error metadata otherwise.
Remarks
👉 Not an MS-VBAL member: VBA has never been able to say where an error came from, only
what it was, which is what makes an Err.Description from deep in a call chain so
uninformative. Read-only, and empty when no error is current.
The trace is captured at the moment the error is raised rather than derived when it is read: by the time a handler reads it, the activations it names have been unwound.