IsError

Returns a Boolean indicating whether an expression is an error value.

Syntax: IsError( expression )

expression
required Any valid expression.

Error values are produced by passing an error number through the CVErr function. IsError returns True if expression indicates an error; otherwise, False.

Example

This example uses IsError to check whether a value is an error. CVErr is used to return an Error-subtype Variant from a user-defined function. UserFunction is assumed to return an error value, for example via UserFunction = CVErr(32767).

Dim ReturnVal As Variant
Dim MyCheck As Boolean
ReturnVal = UserFunction()
MyCheck = IsError(ReturnVal)          ' Returns True.

See Also

License: CC-BY-4.0 Code license: MIT Attribution: VBA-Docs