I am adding some data to Excel file using C# Window form application. But after executing the program, to open excel file i need to close the Window form otherwise i am not able to open not only the excel file to which i added the data but also the any excel file. when i tried to open any excel file without closing Window form application it was not showing any data and cells(just a blank screen).
i need to close my appilcation to view the excel files.Even at the i wrote the code for releasing the COM objects.
workbook = appExl.Workbooks.Open(Excel_file, 0,false, 5, "", "", false, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
workbook.Save();
System.Runtime.InteropServices.Marshal.ReleaseComObject(ShtRange);
System.Runtime.InteropServices.Marshal.ReleaseComObject(NwSheet);
workbook.Close(true, Missing.Value, Missing.Value);
System.Runtime.InteropServices.Marshal.ReleaseComObject(workbook);
appExl.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(appExl);
so please help me how to open excel file without closing application after execution?
Here is a sample code in which i write to excel sheet using C# and it works great.Use folllowing namespaces
using Microsoft.Office.Interop.Excel;
using Excel = Microsoft.Office.Interop.Excel;
check this out