G
Guest
Hi,
I have following code in an aspx page:
Sub Page_Load(ByVal Src As Object, ByVal E As EventArgs)
Dim oExcel As New Excel.Application
Dim oWorkbook As Excel.Workbook
Dim oWorkbooks As Excel.Workbooks
oWorkbooks = oExcel.Workbooks
oWorkbook = oWorkbooks.Open("test.xls")
oExcel.Visible = True
Dim oSheet As Excel.Worksheet = oWorkbook.Worksheets.Item(1)
oWorkbook.Close()
oExcel.Quit()
ReleaseComObject(oSheet)
ReleaseComObject(oWorkbooks)
ReleaseComObject(oWorkbook)
ReleaseComObject(oExcel)
oSheet = Nothing
oWorkbooks = Nothing
oWorkbook = Nothing
oExcel = Nothing
System.GC.Collect()
End Sub
If I remove the oSheet piece, Excel is removed from memory. But when it's
there Excel stays in memory. Can anyone tell me what's wrong?
Thanks, Micke.
I have following code in an aspx page:
Sub Page_Load(ByVal Src As Object, ByVal E As EventArgs)
Dim oExcel As New Excel.Application
Dim oWorkbook As Excel.Workbook
Dim oWorkbooks As Excel.Workbooks
oWorkbooks = oExcel.Workbooks
oWorkbook = oWorkbooks.Open("test.xls")
oExcel.Visible = True
Dim oSheet As Excel.Worksheet = oWorkbook.Worksheets.Item(1)
oWorkbook.Close()
oExcel.Quit()
ReleaseComObject(oSheet)
ReleaseComObject(oWorkbooks)
ReleaseComObject(oWorkbook)
ReleaseComObject(oExcel)
oSheet = Nothing
oWorkbooks = Nothing
oWorkbook = Nothing
oExcel = Nothing
System.GC.Collect()
End Sub
If I remove the oSheet piece, Excel is removed from memory. But when it's
there Excel stays in memory. Can anyone tell me what's wrong?
Thanks, Micke.