Interop: Anyone know how to save an Excel workbook without the "Do you want to save" popup?
-
Does anyone know the incantation to save an excel workbook without having the "Do you want to save" popup appearing? I cannot have the confirmation appear because the alterations I am making to the file need to be seamless.
Application excel = new Application();
Workbook workbook = excel.Workbooks.Open(Filename);
var sheet = workbook.ActiveSheet;
Range column = sheet.Range["B1"].EntireColumn;
column.Insert(XlInsertShiftDirection.xlShiftToRight);
workbook.Save();
//workbook.SaveAs(Filename);
workbook.Close();
Marshal.ReleaseComObject(workbook);
Marshal.ReleaseComObject(excel);This will save the file, but the popup is not suppressed.
"I need build Skynet. Plz send code"
-
Does anyone know the incantation to save an excel workbook without having the "Do you want to save" popup appearing? I cannot have the confirmation appear because the alterations I am making to the file need to be seamless.
Application excel = new Application();
Workbook workbook = excel.Workbooks.Open(Filename);
var sheet = workbook.ActiveSheet;
Range column = sheet.Range["B1"].EntireColumn;
column.Insert(XlInsertShiftDirection.xlShiftToRight);
workbook.Save();
//workbook.SaveAs(Filename);
workbook.Close();
Marshal.ReleaseComObject(workbook);
Marshal.ReleaseComObject(excel);This will save the file, but the popup is not suppressed.
"I need build Skynet. Plz send code"
Try setting DisplayAlerts=false http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._application.displayalerts.aspx[^]
No comment
-
Does anyone know the incantation to save an excel workbook without having the "Do you want to save" popup appearing? I cannot have the confirmation appear because the alterations I am making to the file need to be seamless.
Application excel = new Application();
Workbook workbook = excel.Workbooks.Open(Filename);
var sheet = workbook.ActiveSheet;
Range column = sheet.Range["B1"].EntireColumn;
column.Insert(XlInsertShiftDirection.xlShiftToRight);
workbook.Save();
//workbook.SaveAs(Filename);
workbook.Close();
Marshal.ReleaseComObject(workbook);
Marshal.ReleaseComObject(excel);This will save the file, but the popup is not suppressed.
"I need build Skynet. Plz send code"
-
Try setting DisplayAlerts=false http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._application.displayalerts.aspx[^]
No comment