how to close an application using automation

G

Guest

Hi
I am writing an application using VB.NET and office 2003.
I write some data into the Excel sheetand tehn close it
but, I can still see teh excel.exe running in the task
manager. .Please help me...:((

The code I am using is :

Dim Excel As New Excel.ApplicationClass
' Get a new workbook
Dim oBook As Excel._Workbook = CType
(Excel.Workbooks.Add(oTemplate), Excel._Workbook)
.....
....
oBook.SaveAs("c:\SearchResults.xls")
Excel.ActiveWorkbook.Close(False)

System.Runtime.InteropServices.Marshal.ReleaseComObject
(oBook) ' releases the workbook object
oBook = Nothing
Excel.Quit()

System.Runtime.InteropServices.Marshal.ReleaseComObject
(Excel) ' releases the excel object
Excel = Nothing

Thanks a lot..
Vishal
 
Top