Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
Not able to clear the Excel.exe even after the System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj) in c#
Aurosish Mohanty
Feb 22 2011 2:09 AM
4.2k
Reply
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);
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
MAPI32.DLL
c# web app using Windows Image Acquisition (WIA) in Windows Server 2008