saveas覆盖数据后exel的问题 [英] Problem with exel after saveas overwrite data
本文介绍了saveas覆盖数据后exel的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我编写了以下代码打开我的excel文件并将其保存为文本文件
So I have written the below code that open my excel file and save it as text file
Dim xl As New Excel.Application
Dim xlBook As Excel.Workbook = xl.Workbooks.Open("C:\ExcelData.xlsx")
Dim xlSheet As Excel.Worksheet = xlBook.Sheets("Sheet1")
xlSheet.SaveAs("C:\Data.txt", Excel.XlFileFormat.xlTextWindows)
xlBook.Close
问题是它保存文件后i9t提示我要保存更改,当我单击是时它会覆盖文件来自excel的最新opned表。
如何阻止它覆盖并阻止它提示我进行更改?
The problem is after it save the file i9t prompt me do you want to save changes and when I click Yes it overwrite the file with the latest opned sheet from the excel.
How can I stop it from overwriting and stop it from prompt me for changes?
推荐答案
我在开头添加以下代码解决了这个问题:
I solve it mtself by adding the below code at begining:
xl.DisplayAlerts = False
这篇关于saveas覆盖数据后exel的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文