如何在后台打开 Excel 在窗口 10 中而不“另存为”

本文关键字:另存为 窗口 后台 Excel | 更新日期: 2023-09-27 18:32:20

此代码在后台打开 excel,在 Windows 7 和 8 上没有问题,但在 Windows 10 上它会弹出"另存为"提示。您知道如何摆脱"另存为"提示吗?

object misValue = System.Reflection.Missing.Value;
xlApp = new Excel.Application();
//xlApp.Visible = false; // this does not help to get rid of save as
//xlApp.DisplayAlerts = false; // this does not help to get rid of save as
//xlApp.ScreenUpdating = false; // this does not help to get rid of save as
xlWorkBook = xlApp.Workbooks.Open(excelFileURL, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "'t", false, false, 0, true, 1, 0);
xlWorkSheet = xlWorkBook.Worksheets.get_Item(1);

如何在后台打开 Excel 在窗口 10 中而不“另存为”

试试这个:

excelWorkbook.SaveAs(excelFileURL, AccessMode: Excel.XlSaveAsAccessMode.xlExclusive);

> 另存为在 Office 2016 上关闭 Excel 时弹出它与Windows 10无关

关闭而不"另存为"promt

xlWorkBook.Close(false, misValue, misValue);