I'm creating excel from asp.net and it creates Excel.exe in memory. How can I get rid of it?
Dim oXL As Excel.Application
Dim oWB As Excel._Workbook
Dim oSheet As Excel._Worksheet
GC.Collect() ' clean up any other excel guys hangin' around...
oXL = New Excel.Application
oXL.Visible = False
'Get a new workbook.
oWB = oXL.Workbooks.Add
'new work sheet
oSheet = oWB.Worksheets.Add
oSheet.Range("A4").Value = "GOOD"
oXL.Visible = False
oXL.UserControl = False
Dim strFileName As String = "report.xls"
oWB.SaveAs(strCurrentDir + strFileName)
' Need all following code to clean up and extingush all references!!!
oWB.Close(Nothing, Nothing, Nothing)
oXL.Workbooks.Close()
oXL.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oXL)
System.Runtime.InteropServices.Marshal.ReleaseComObject(oSheet)
System.Runtime.InteropServices.Marshal.ReleaseComObject(oWB)
oSheet = Nothing
oWB = Nothing
oXL = Nothing
GC.Collect() ' force final cleanup!
Dim oXL As Excel.Application
Dim oWB As Excel._Workbook
Dim oSheet As Excel._Worksheet
GC.Collect() ' clean up any other excel guys hangin' around...
oXL = New Excel.Application
oXL.Visible = False
'Get a new workbook.
oWB = oXL.Workbooks.Add
'new work sheet
oSheet = oWB.Worksheets.Add
oSheet.Range("A4").Value = "GOOD"
oXL.Visible = False
oXL.UserControl = False
Dim strFileName As String = "report.xls"
oWB.SaveAs(strCurrentDir + strFileName)
' Need all following code to clean up and extingush all references!!!
oWB.Close(Nothing, Nothing, Nothing)
oXL.Workbooks.Close()
oXL.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(oXL)
System.Runtime.InteropServices.Marshal.ReleaseComObject(oSheet)
System.Runtime.InteropServices.Marshal.ReleaseComObject(oWB)
oSheet = Nothing
oWB = Nothing
oXL = Nothing
GC.Collect() ' force final cleanup!