I am struggling a lot while trying to close the Excel sheet and any Excel object using the
System.Runtime.InteropServices.
Marshal.FinalReleaseComObject(obj)Even though I am using the below code, the EXCEL.EXE is still running in the back , so not able to open and modify the Excel sheet.
Please help me ............. Need your quick response.
private
{
{
System.Runtime.InteropServices.
obj =
}
{
obj =
}
{
{
System.Runtime.InteropServices.
System.Threading.
}
}
}
if (obj != null)Marshal.FinalReleaseComObject(obj);Thread.Sleep(5000);
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Feb 21, 2011, 10:42 PM EST
Try this ! .
excelApp.Quit();
Marshal.ReleaseComObject (excelWB);
Marshal.ReleaseComObject (excelApp);
excelApp = null;
This worked for a project which I was working on.
Press CheckBox if you feel this is correct answer !
Aurosish Mohanty4 reputationPosted Feb 21, 2011, 10:54 PM EST
In my case I am opening the same Excel again and again in a loop and everytime I am trying to edit the sheet.
Please suggest me if any other solution ./..