Disable message when editing an Excel document programmically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

How can I disable that message/question that appears when my program edits
an Excel file?

Here's the code:

Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open( fileName, 0, false,
5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true,
false, false);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
Excel.Worksheet excelWorksheet =
(Excel.Worksheet)excelSheets.get_Item("Sheet1");
excelWorksheet.get_Range("A1", "A1").Value2 = "'Testing";
excelWorksheet.get_Range("A2", "A2").Value2 = "'Example";
etc. etc.
excelApp.Workbooks.Close();

The question that appears (from Excel) is the following "Do you want to save
changes you made to <filename>?"

Any ideas?

Thanks,

David
 
and I believe that there is an optional parameter to the close method
that says 'save changes' or prompt to save changes.

if you open up Excel, and you go.. Tools, Visual C# Editor.

OH WAIT A SECOND, C# IS FOR ****ING FAGS AND DOESNT WORK WITH MS
OFFICE DOES IT??
 
Try this:

excelApp.DisplayAlerts = False
excelApp.Workbooks.Close()
excelApp.DisplayAlerts = True

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
 
That removed the message thanks, but now my Excel document does not contain
any of the edits that my program made.

Is there anything more you can suggest?
Thank,

David
 
save your spreadsheet you ****ing retard





That removed the message thanks, but now my Excel document does not contain
any of the edits that my program made.

Is there anything more you can suggest?
Thank,

David







- Show quoted text -
 
Did you save the Excel workbook before closing it?

Robin S.
---------------------------------------
 
Back
Top