can't remove Excel instance from memory using asp.net

G

Guest

I use Excel in asp.net to generate xls. After finish the file generation, I
use gc.collect to clear object used in the system. But I still found
EXCEL.EXE through the task manager. Please advise.
 
M

Mark Rae

I use Excel in asp.net to generate xls. After finish the file generation,
I
use gc.collect to clear object used in the system. But I still found
EXCEL.EXE through the task manager. Please advise.

Are you calling the Quit() method after closing the file?
 
M

Mark Rae

Already use objExcel.Quit(), but the instance still in memory.

OK. After calling the Quit() method, are you setting objExcel to null (or
Nothing, in VB.NET)?
 
G

Guest

I found that when I tried to access the worksheet object in the Excel like
the followings, then I call the ReleaseCOMObject and then using GC.collect,
the EXCEL.EXE still in memory. Is there anything I did wrongly? Pls advise.
Thx! :)

oWorkSheet = oWorkBook.Sheets(nWorkSheet)
sWorkSheetName = oWorkSheet.Name()
TemplateDataView.RowFilter = "Template_Name='" & sWorkSheetName & "'"
..
..
..
oExcel.Quit()
oExcel = Nothing
NAR(oRange)
NAR(oWorkSheet)
NAR(oWorkBook)
NAR(oBooks)
NAR(oExcel)

GC.Collect()

Private Sub NAR(ByVal o As Object)
Try
ReleaseComObject(o)
Catch
Finally
o = Nothing
End Try
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top