This works for me:
'Clean-up: Close the workbook and quit Excel.
If oBook IsNot Nothing Then
oBook.Close(False)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oBook)
oBook = Nothing
End If
If oBooks IsNot Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oBooks)
oBooks = Nothing
End If
If oExcel IsNot Nothing Then
oExcel.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oExcel)
oExcel = Nothing
End If
"SteveS" <SteveS@discussions.microsoft.com> wrote in message
news:1F8ADD54-0BEA-4862-8643-288900B3C5FD@microsoft.com...[color=blue]
> Ken,
> I used the following but it still leaves a Excel process open in Task
> Manager.
>
> System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlApp)
> System.Runtime.InteropServices.Marshal.ReleaseComO bject(wb)
> System.Runtime.InteropServices.Marshal.ReleaseComO bject(xlSheet)
> xlApp = Nothing
> wb = Nothing
> xlSheet = Nothing
>
> GC.Collect()
> GC.WaitForPendingFinalizers()
> GC.Collect()
>
> --
> Thank You
>
>
> "Ken Tucker [MVP]" wrote:
>[color=green]
>> Hi,
>>
>> Use marshal.releasecomobject
>>
>>
http://www.vb-tips.com/default.aspx?...3-cc46c8615787
>>
>> Ken
>> ---------------
>>
>> "SteveS" wrote:
>>[color=darkred]
>> > I'm attempting to close EXCEL from within my VB.NET application.
>> > Using the excel object library to write data to my spreadsheet is
>> > working
>> > fine but when I try to quit application object it does not work. I
>> > know this
>> > because I can still see the Excel application running in Task Manager.
>> >
>> > How do I shut down EXCEL?
>> >
>> > I have tried the QUIT method and Interop.RemoveComponent.
>> >
>> > --
>> > Thank You[/color][/color][/color]