Vba 打开工作簿时关闭Excel后台错误检查

Vba 打开工作簿时关闭Excel后台错误检查,vba,excel,Vba,Excel,我有一个excel工作簿,有很多绿色的“错误检查”三角形 有没有办法在打开工作簿时使用Excel VBA关闭此功能。我找到了我想要的答案: Sub Auto_Open() Application.ErrorCheckingOptions.BackgroundChecking = False End Sub 我想这就是你想要的: Application.ErrorCheckingOptions.BackgroundChecking = False 简单地说: With App

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


有没有办法在打开工作簿时使用Excel VBA关闭此功能。

我找到了我想要的答案:

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

我想这就是你想要的:

    Application.ErrorCheckingOptions.BackgroundChecking = False
简单地说:

With Application.ErrorCheckingOptions
    .BackgroundChecking = False
    .EvaluateToError = False
    .TextDate = False
    .NumberAsText = False
    .InconsistentFormula = False
    .OmittedCells = False
    .UnlockedFormulaCells = False
    .ListDataValidation = False
End With
如果使用上述代码,它将永远关闭所有excel文档的未来

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


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

如果您仍然希望“受保护”选项卡可以访问,则只需解锁所有单元格并在保护之前选择适当的保护选项即可


我不想使用宏,因为这可能会影响用户在各种工作簿和选项卡上的设置。

2天前,我在查看我的一份现有报告时发现其中有很多三角形。我只是通过重构公式来摆脱它们。如果你选择了所有的值,点击三角形并选择“忽略这个错误”,它们都会消失-或者-你可以修正错误,比如改变值,这样它就不会那样做了。对我来说很有用。我把它放在
Private子工作簿\u Open()
thiswoolk
宏页面中。
    '''''''''''''''' 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
'''''''''''''''''''''''''''''''''''''''''''''''''''''''