Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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(); |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using interop.excel to open a workbook, the workbook doesn't ask to save changes.
I don't know C#, but as a guess maybe one of those false's is doing the VBA
equivalent of Application.DisplayAlerts = False This is an application level setting that needs to be reset to True. Regards, Peter T wrote in message oups.com... 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(); |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code to open new workbook, prompt for 'save as' name. | Excel Programming | |||
Why when i have more than one workbook open and i want to save ch. | New Users to Excel | |||
Open a password protected excel workbook from second workbook to fetch data using dynamic connection | Excel Programming | |||
Excel Workbook opened twice with dotnet interop | Excel Programming | |||
What commands do you use to name a workbook, save a workbook,open a workbook | Excel Programming |