VBS tutorial: VBScript attribute – number attribute

Time:2021-12-31

Number property

Returns or sets an error specifying a value.NumberyesErrObject.

object.Number [= errornumber]

parameter

object

ErrObject.

errornumber

An integer representing the VBScript error number or scode error value.

explain

When a user-defined error is returned from the automation object, the selected number is added to the constant as an error codevbObjectErrorTo setErr.Number

The following code illustrates how to useNumberattribute

On Error Resume NextErr. Raise vbobjecterror + 1, "someobject" 'generates an object error #1 MsgBox ("Error # " & CStr(Err.Number) & " " & Err. Description)Err. Clear 'clear the error.