ebError (constant)

Description

Number representing the type of an error variant.

Comments

This constant is equal to 10.

Example

This example checks to see whether a variable is an error.

Function Div(ByVal a As Variant,ByVal b As Variant) As Variant
  On Error Resume Next
  Div = a / b
  If Err <> 0 Then Div = CVErr(Err)
End Function

Sub Main()
  a = InputBox("Please enter 1st number","Division Sample")
  b = InputBox("Please enter 2nd number","Division Sample")

  res = Div(a,b)

  If VarType(res) = ebError Then
    res = CStr(res)
    res = Error(Mid(res,7,Len(res)))
    MsgBox "'" & res & "' occurred"
  Else
    MsgBox "The result of the division is: " & res
  End If
End Sub

See Also

VarType (function); Variant (data type).

More information

E