help !!! please... closing excel application using automation

G

Guest

Hi
I am writing an application using VB.NET and office 2003.
I write some data into the Excel sheet using automation
and then close it but, I can still see the 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
 
R

Rob van Gelder

Vishal,

You should call your object something other than "Excel"
Call it oExcel instead.

Let me know if that helps?

Rob
 
G

Guest

Hi Rob

I tried that, but it did not helped...
I do not know what the name of variable has to do with
this problem.


Vishal..
 
P

PhilEvans

Vishal

did you get an answer to the problem ?
I'm experiencing exactly the same problem with my new app.

Any help would be appreciated

PhilEvan
 

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

Top