VBA工作簿。关闭而不被提示,如果用户想保存? [英] VBA workbooks.Close without being prompted to if the user wants to save?
本文介绍了VBA工作簿。关闭而不被提示,如果用户想保存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个VBA程序,将 .xls
文件转换为 .csv
文件。问题是这是打开要保存更改为myFile.csv吗?
对话框。
I am writing a VBA program that converts .xls
files into .csv
files. The problem is that is brings up the "Do you want to save the changes to myFile.csv?"
Dialog box.
这是我的代码片段:
currentBook.SaveAs Filename:=fileNameS, FileFormat:=xlCSV, ConflictResolution:=xlLocalSessionChanges
currentBook.Close SaveChanges:=False
我需要添加什么,以便我没有得到您要将更改保存到 myFile.csv
吗?对话框?
What do I need to add so that I don't get the "Do you want to save the changes to myFile.csv
?" Dialog box?
推荐答案
尝试使用 ThisWorkbook.Saved = True
p>
Try using ThisWorkbook.Saved = True
Application.DisplayAlerts = False
currentBook.SaveAs Filename:=fileNameS, FileFormat:=xlCSV, ConflictResolution:=xlLocalSessionChanges
currentBook.Saved = True
currentBook.Close SaveChanges:=False
Application.DisplayAlerts = True
这篇关于VBA工作簿。关闭而不被提示,如果用户想保存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文