Error
This keyword/value can only be used in conjunction with the Variant data type.
This keyword/value can be used to store an error number.
Normal error handling does not occur giving you the chance to take alternative action in code
Error values can be created by converting real numbers to error values using the CVErr() function
Error values are automatically generated by VBA when an error occurs.
Dim vMyVariant As Variant
vMyVariant = Error
vMyVariant = Error(9)
CVError
CVERR - Returns a specific type of error.
IsError Function
ISERROR - Returns the value True or False depending if the expression is an error.
varType.vbError
There is a built-in constant that can be used to help identify errors.
Dim myError As Variant
myError = CVErr(6)
If (VarType(myError) = VBA.vbVarType.vbError) Then
Debug.Print "Error"
End If
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext