Excel persists after .Quit()

  • Thread starter Thread starter Steven
  • Start date Start date
S

Steven

Does anyone know whats going on here?

I'm filling Excel with data via a VB.NET app, then
closing it as follows, but an Excel Object seems to
remain alive.

Private Function CloseExcel(ByVal strFile As String) As
Integer

If strFile.Length > 0 Then
oBook.SaveAs(strFile)
Else
oBook.Close(False)
End If

oSheet = Nothing
oBook = Nothing
appExcel.Quit()
appExcel = Nothing
System.GC.Collect()

End Function

In Task Manager it can clearly be seen and when I try and
open the spreadsheet by double clicking on it nothing
happens.

Excel dissapears once I close my app, but I need to have
both running.
 
Steven,

Make sure you call the following on every excel object that you instantiate:
System.Runtime.InteropServices.Marshal.ReleaseComObject(exlObject). This
call explicitly decreases the COM reference counter.

Dan
 
Back
Top