View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] milmans@gmail.com is offline
external usenet poster
 
Posts: 1
Default Using interop.excel to open a workbook, the workbook doesn't ask to save changes.

I'm using C# and the Interop.Excel assembly to programatically open an
..xls file, make some changes, then save the changes.
The code works fine, the changes are saved, etc. But when I use excel
to open the file, then make some changes manually, Excel no longer
prompts me to save my changes - it just closes the file without saving.

here is the C# code that I'm running. Before I run this code, junk.xls
works normally. It prompts for changes, etc. After I run this code,
junk.xls no longer prompts me to save any changes that I've made. This
code doesn't even change or save junk.xls (as far as I can tell). Can
anyone help?

Excel.ApplicationClass app = new Excel.ApplicationClass();
Excel.Workbook wb2 = (Excel.Workbook)app.Workbooks.Open(
"c:\\temp\\junk2.xls",
false,
false,
Type.Missing,
Type.Missing,
Type.Missing,
true,
Type.Missing,
Type.Missing,
true,
false,
Type.Missing,
false,
Type.Missing,
true);

wb2.Close(false, Type.Missing, Type.Missing);
app.Quit();