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
 

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

Similar Threads

Closing Excel 2
Save Excell file as 8
Excel vs. Office Web Components 3
Chart Automation leaves hidden instance of Excel running 2
vb.net interop 1
Arrays 2
Excel Automation 4
Releasing Excel from memory 7

Back
Top