Hi all,
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
{
static void releaseObject(object obj)try{
System.Runtime.InteropServices.
obj =
}
{
obj =
}
GC.Collect();GC.WaitForPendingFinalizers();GC.Collect();GC.WaitForPendingFinalizers();Marshal.FinalReleaseComObject(obj);null;catch (Exception ex)null;finally{
{
System.Runtime.InteropServices.
System.Threading.
}
}
}
if (obj != null)Marshal.FinalReleaseComObject(obj);Thread.Sleep(5000);