假设我打开了一个名为“DataSheet.xls”的 Excel 文件。我如何使用 C# 杀死该 Excel 文件?
最佳答案
using Excel = Microsoft.Office.Interop.Excel;
(...)
var app = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
// I have english excel, but another culture and need to use english culture to use excel calls...
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
app.Workbooks["DataSheet"].Close(false, false, false);
关于c# - 以编程方式关闭 Excel 中的工作簿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3051321/