Problem saving excel file after inserting data
- by Cmptrb
Hi,
I want to write data to an existing excel file ( I do it easily )
But I can not save the changes on the excel file ( actually I see the changes on the excel file, but it seems opened and after all it occurs some problems such as "the file is already opened with same name and so on ... )
Excel.Application app= new Microsoft.Office.Interop.Excel.Application();
Excel.Workbook appbook= app.Workbooks.Open(appxls, 0, true, 5, "", "", false, Excel.XlPlatform.xlWindows, "\t", true, false, 0, true, Missing.Value, Missing.Value);
Excel.Sheets pages= appbook.Worksheets;
Excel.Worksheet page= (Excel.Worksheet)pages.get_Item(1);
//... i change some values on the excel file and want to save them :
// appxls is a string holding the path
appbook.SaveAs(appxls, Excel.XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing,false, Type.Missing, Excel.XlSaveAsAccessMode.xlShared, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
appbook.Close(true, Missing.Value, Missing.Value);
app.Quit();
Where is the problem, how can I solve it using Microsoft.interop.