返回或设置指定错误的数值。Number 是 Err 对象的默认属性。
语法
object.Number
参数:
Object:必需。始终为 Err 对象
以下代码说明了 Number 属性的用法。
Sub RaiseBuiltInError()
On Error Resume Next ' Enable error handling.
Err.Raise 13 ' Raise a Type Mismatch error.
Output = "Error # " & Err.Number & ": " & Err.Description
Err.Clear ' Clear the error.
End Sub
'Output: Error # 13: Type mismatch