CVErr (function)

Syntax CVErr (expression)
Description Converts expression to an error.
Comments This function is used to convert an expression into a user-defined error number. A runtime error is generated under the following conditions: If expression is Null . If expression is a number outside the legal range for errors, which is as follows:
    0 <= expression <= 65535
If expression is Boolean . If expression is a String that can't be converted to a number within the legal range. Empty is treated as 0.
Example This example simulates a user-defined error and displays the error number.
Sub Main()
  MsgBox "The error is: " & CStr(CVErr(2046))
End Sub
See Also CCur (function); CBool (function); CDate, CVDate (functions); CDbl (function); CInt (function); CLng (function); CSng (function); CStr (function); CVar (function), IsError (function).