关闭Excel背景错误检查打开工作簿

时间:2011-01-21 00:04:18

标签: excel vba excel-vba

我有一个excel工作簿有很多绿色的“错误检查”三角形。

当我打开工作簿时,有没有办法使用Excel VBA。

4 个答案:

答案 0 :(得分:9)

我认为这就是你要找的东西:

    Application.ErrorCheckingOptions.BackgroundChecking = False

答案 1 :(得分:3)

我找到了我追求的答案:

Sub Auto_Open()
    Application.ErrorCheckingOptions.BackgroundChecking = False 
End Sub

答案 2 :(得分:1)

我通常会将工作簿标签拆分为数据,计算和演示文稿。因此,我不喜欢在“Presentation”选项卡中为表格的绿色错误检查三角形。一种方法是保护纸张......绿色检查消失了! (仅适用于该标签)

如果您仍希望可以访问受保护的标签页,则只需解锁所有单元格,然后在保护之前选择适当的保护选项。

我不会使用宏,因为这可能会影响各种工作簿和标签中的用户设置。

答案 3 :(得分:0)

只需使用:

With Application.ErrorCheckingOptions
    .BackgroundChecking = False
    .EvaluateToError = False
    .TextDate = False
    .NumberAsText = False
    .InconsistentFormula = False
    .OmittedCells = False
    .UnlockedFormulaCells = False
    .ListDataValidation = False
End With

如果你使用上面的代码,它将永远关闭这个未来和所有excel文档。

但是如果您只想为您的Excel文档(不是所有人)执行此操作,请执行以下操作:

    '''''''''''''''' IN A MODULE '''''''''''''''''''
    Public AE_BackgroundChecking As Boolean
    Public AE_EvaluateToError As Boolean
    Public AE_TextDate As Boolean
    Public AE_NumberAsText As Boolean
    Public AE_InconsistentFormula As Boolean
    Public AE_OmittedCells As Boolean
    Public AE_UnlockedFormulaCells As Boolean
    Public AE_ListDataValidation As Boolean
    Public AE_EmptyCellReferences As Boolean
    ''''''''''''''''''''''''''''''''''''''''''''''''

    ''''''''''''''''' IN WORKBOOK OPEN EVENT '''''''''''''

    AE_BackgroundChecking = Application.ErrorCheckingOptions.BackgroundChecking
    AE_EvaluateToError = Application.ErrorCheckingOptions.EvaluateToError
    AE_TextDate = Application.ErrorCheckingOptions.TextDate
    AE_NumberAsText = Application.ErrorCheckingOptions.NumberAsText
    AE_InconsistentFormula = Application.ErrorCheckingOptions.InconsistentFormula
    AE_OmittedCells = Application.ErrorCheckingOptions.OmittedCells
    AE_UnlockedFormulaCells = Application.ErrorCheckingOptions.UnlockedFormulaCells
    AE_ListDataValidation = Application.ErrorCheckingOptions.ListDataValidation
    AE_EmptyCellReferences = Application.ErrorCheckingOptions.EmptyCellReferences

    With Application.ErrorCheckingOptions
        .BackgroundChecking = False
        .EvaluateToError = False
        .TextDate = False
        .NumberAsText = False
        .InconsistentFormula = False
        .OmittedCells = False
        .UnlockedFormulaCells = False
        .ListDataValidation = False
        .EmptyCellReferences = False
    End With
    ''''''''''''''''''''''''''''''''''''''''''



''''''''''''''''' IN WORKBOOK CLOSE EVENT '''''''''''''
Application.ErrorCheckingOptions.BackgroundChecking = AE_BackgroundChecking
Application.ErrorCheckingOptions.EvaluateToError = AE_EvaluateToError
Application.ErrorCheckingOptions.TextDate = AE_TextDate
Application.ErrorCheckingOptions.NumberAsText = AE_NumberAsText
Application.ErrorCheckingOptions.InconsistentFormula = AE_InconsistentFormula
Application.ErrorCheckingOptions.OmittedCells = AE_OmittedCells
Application.ErrorCheckingOptions.UnlockedFormulaCells = AE_UnlockedFormulaCells
Application.ErrorCheckingOptions.ListDataValidation = AE_ListDataValidation
Application.ErrorCheckingOptions.EmptyCellReferences = AE_EmptyCellReferences
'''''''''''''''''''''''''''''''''''''''''''''''''''''''