closuresExcel背景错误检查打开工作簿

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

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

我想这是你要找的东西:

Application.ErrorCheckingOptions.BackgroundChecking = False 

我find了我之后的答案:

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

我通常将我的工作簿选项卡分为数据,计算和演示。 因此,我不喜欢绿色错误检查我的“演示文稿”选项卡中的表格的三angular形。 一种方法是保护表格…绿色支票走开! (并只为该选项卡)

如果您仍然希望受保护的选项卡可以访问,则只需解锁所有单元,然后select适当的保护选项,然后再进行保护。

我会远离使用macros,因为这可能会影响跨各种工作簿和选项卡的用户设置。

简单地使用这个:

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

如果你使用上面的代码,它永远closures这个未来,并为所有的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 '''''''''''''''''''''''''''''''''''''''''''''''''''''''