Disable message when editing an Excel document programmically

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
 
A

aaron.kempf

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??
 
R

RobinS

Try this:

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

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
 
G

Guest

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
 
P

pfc_sadr

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 -
 
R

RobinS

Did you save the Excel workbook before closing it?

Robin S.
---------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top