ErrorCheckingOptions 对象

         
Application
ErrorCheckingOptions

表示某个应用程序的错误检查选项。

ErrorCheckingOptions 对象的用法

使用 Application 对象的 ErrorCheckingOptions 属性可返回一个 ErrorCheckingOptions 对象。

引用 Errors 对象的 Item 属性可查看与错误检查相关的索引值列表。

返回一个 ErrorCheckingOptions 对象之后,可使用以下属性设置或返回错误检查选项。这些属性都是 ErrorCheckingOptions 对象的成员。

在下例中,使用 TextDate 属性可启用以两位数表示年份的文本日期的错误检查,并通知用户。

Sub CheckTextDates()

    Dim rngFormula As Range
    Set rngFormula = Application.Range("A1")

    Range("A1").Formula = "'April 23, 00"
    Application.ErrorCheckingOptions.TextDate = True

    ' Perform check to see if 2 digit year TextDate check is on.
    If rngFormula.Errors.Item(xlTextDate).Value = True Then
        MsgBox "The text date error checking feature is enabled."
    Else
        MsgBox "The text date error checking feature is not on."
    End If

End Sub