R
Raymond Chiu
Dear all,
I have written the following code in the button click event but find that
excel session object always remain in the server as seen from taskmanager.
Do you know why?
------------------------------------------------------------------------------
Dim objExcel As New Microsoft.Office.Interop.Excel.Application
Dim objSheet As Microsoft.Office.Interop.Excel.Worksheet
objExcel.Workbooks.Open(Page.MapPath("reports\Cost.xls"))
objExcel.DisplayAlerts = False
objSheet = objExcel.ActiveSheet
Dim sFileName As String = InvNo & "_" & Format(Date.Now(), "yyyyMMddHHmm") &
".xls"
objSheet.SaveAs(Page.MapPath("..\out\" & sFileName))
objExcel.Workbooks.Close()
objExcel.Quit()
objSheet = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcel)
Page.Response.Redirect("dl.aspx?filename=" & sFileName)
I have written the following code in the button click event but find that
excel session object always remain in the server as seen from taskmanager.
Do you know why?
------------------------------------------------------------------------------
Dim objExcel As New Microsoft.Office.Interop.Excel.Application
Dim objSheet As Microsoft.Office.Interop.Excel.Worksheet
objExcel.Workbooks.Open(Page.MapPath("reports\Cost.xls"))
objExcel.DisplayAlerts = False
objSheet = objExcel.ActiveSheet
Dim sFileName As String = InvNo & "_" & Format(Date.Now(), "yyyyMMddHHmm") &
".xls"
objSheet.SaveAs(Page.MapPath("..\out\" & sFileName))
objExcel.Workbooks.Close()
objExcel.Quit()
objSheet = Nothing
System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcel)
Page.Response.Redirect("dl.aspx?filename=" & sFileName)