Dear all,
I am working on windows application. In this application i am working office 2007. i can open .xlsx file using following code.
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
excelApp.Visible = true;
Microsoft.Office.Interop.Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(varFileName,0, false, 5, """, """, false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, """,
true, false, 0, true, false, false);
Microsoft.Office.Interop.Excel.Worksheet workSheet = (Microsoft.Office.Interop.Excel.Worksheet)excelWorkbook.ActiveSheet;
workSheet.Activate();
After that I will do some modification on same xlsx file.
Now problem start with, when I want to save the file.
I am doing this using following code.
excelApp.ActiveWorkbook.Save();
excelApp.ActiveWorkbook.Close((Object)false, (Object)oMissing, (Object)oMissing);
excelApp.Quit();
It shows exception as Object reference not set to an instance of an object. It will not show any active document. It shows
ActiveWorkbook=null;
Any kind of link, suggestion and specially expert advice would be highly appreciated.
Thanks & Regards,
Balkrishna Raut