ErrorCheckingOptions 对象 (Excel)

代表应用程序的错误检查选项。

备注

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

引用 Errors 对象的 Item 属性,以查看与错误检查选项关联的索引值列表。

返回 ErrorCheckingOptions 对象后,可以使用以下属性( ErrorCheckingOptions 对象的成员)来设置或返回错误检查选项。

  • BackgroundChecking
  • EmptyCellReferences
  • EvaluateToError
  • InconsistentFormula
  • IndicatorColorIndex
  • NumberAsText
  • OmittedCells
  • TextDate
  • UnlockedFormulaCells

示例

以下示例使用 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

属性

另请参阅

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。