ISERROR |
ISERROR(expression) |
Returns the value True or False depending if the expression is an error (Boolean). |
expression | The expression to test. |
REMARKS |
* Error values can be explicitly created using the CVErr() function. * You can use the CVERR function to return a specific type of error. * You can use the ERROR Function to return the error message corresponding to a given error number. * You can use the ERROR Statement to generate an error. * You can use the ISARRAY function to return True or False depending if the value is an array. * You can use the ISDATE function to return True or False depending if the value is a date. * You can use the ISEMPTY function to return True or False depending if the variable has been initialised. * You can use the ISMISSING function to return True or False depending if an optional argument has been passed in. * You can use the ISNULL function to return True or False depending if the value contains no data. * You can use the ISNUMERIC function to return True or False depending if the value is a number. * You can use the ISOBJECT function to return True or False depending if the variable represents an object. * The equivalent .NET function is [[Microsoft.VisualBasic.Information.IsError]] * For the Microsoft documentation refer to learn.microsoft.com |
Debug.Print IsError(CVErr(6)) '= True
Debug.Print IsError(CVErr(11)) '= True
Debug.Print IsError(CVErr(55)) '= True
Debug.Print IsError(Error(6)) '= False
Debug.Print IsError(CVErr(-100)) ' generates an Invalid Procedure Call or Argument run-time error
Debug.Print IsError(10/ 0) ' generates a Division by Zero run-time error
Private Sub MyProcedure(Optional ByVal vVariant As Variant)
If IsError(vVariant) Then
End If
End Sub
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top