vba Excel 2013 DisplayAlerts False 仍在提示退出时保存更改

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26771865/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 05:08:45  来源:igfitidea点击:

Excel 2013 DisplayAlerts False is still prompting for changes save upon quitting

excelvba

提问by Snake

I have a macro that does some calculations then it is supposed to close excel withOUT prompting to save any changes and withOUT saving.

我有一个做一些计算的宏,然后它应该关闭excel而不提示保存任何更改并且不保存。

Here is the code:

这是代码:

Application.DisplayAlerts = False
ThisWorkbook.Saved = True
Application.Quit

This works fine on Excel 2010. On Excel 2013 (64 bit version), This is also working fine. However, My friend using Excel 2013(32 bit version..not sure if it makes a difference) and the Excel is prompting him to save changes before closing.

这在 Excel 2010 上工作正常。在 Excel 2013(64 位版本)上,这也工作正常。但是,我的朋友使用 Excel 2013(32 位版本..不确定它是否有区别)并且 Excel 提示他在关闭前保存更改。

Is there a different code I should be using for 2013? Any idea?

我应该在 2013 年使用不同的代码吗?任何的想法?

Thank you so much

非常感谢

采纳答案by Paresh J

This Save changes pop up appears in case if your excel contains any volatile functions as such. This function gets updated on workbook open and hence at the time of closing save changes dialog box appears. To suppress this you can use following code and i hope this will work:

如果您的 excel 包含任何易变函数,则会出现此保存更改弹出窗口。此函数在工作簿打开时更新,因此在关闭保存更改对话框时出现。要抑制这种情况,您可以使用以下代码,我希望这会起作用:

Application.EnableEvents = False
Application.DisplayAlerts = False
ThisWorkbook.Saved = True
Application.Quit