如何在Windows 10中在后台打开Excel而不用"另存为"

时间:2016-01-28 12:39:26

标签: c# excel windows-10-desktop

此代码在后台打开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);

2 个答案:

答案 0 :(得分:0)

试试这个:

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

答案 1 :(得分:0)

在Office 2016关闭excel期间另存为弹出窗口 它与Windows 10无关

在没有“另存为”的情况下关闭

xlWorkBook.Close(false, misValue, misValue);