Excel 2010 VBA - 关闭文件没有提示没有保存
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24892723/
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
Excel 2010 VBA - Close file No Save without prompt
提问by Lugarini
I want to close a Excel 2010 file with VBA.. but when the code runs, it shows a prompt confirmation.... i dont want to see this prompt..
我想用 VBA 关闭 Excel 2010 文件..但是当代码运行时,它显示提示确认..我不想看到这个提示..
didnt work:
没有工作:
Application.DisplayAlerts = False
ActiveWorkbook.Close SaveChanges:=False
is there a way to do this?
有没有办法做到这一点?
回答by mrbungle
If you're not wanting to save changes set savechanges to false
如果您不想保存更改,请将 savechanges 设置为 false
Sub CloseBook2()
ActiveWorkbook.Close savechanges:=False
End Sub
for more examples, http://support.microsoft.com/kb/213428and i believe in the past I've just used
有关更多示例,请访问 http://support.microsoft.com/kb/213428,我相信过去我刚刚使用过
ActiveWorkbook.Close False