ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   application is not getting closed through automation (https://www.excelbanter.com/excel-programming/286838-application-not-getting-closed-through-automation.html)

No Name

application is not getting closed through automation
 
Hi

I am using VB.NET and Office 2003. I have written a small
program, which creats an excel application and writes teh
data into the sheet and the closes the application. But
when i go to the task manager, I can still see the
excel.exe running there.
Plese 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.ReleaseComO bject
(oBook) ' releases the workbook object
oBook = Nothing
Excel.Quit()

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


Thanks Vishal

BrianB

application is not getting closed through automation
 
Try
Set Excel = Nothing

I wonder if you should be using something like 'MyExcel' instead, there
are often hidden problems with (semi-) reserved words.


---
Message posted from http://www.ExcelForum.com/


No Name

application is not getting closed through automation
 
I am doing that. Pls see the code attached with the
original post.
I am using VB.net so there is no set command. I am still
not able to close the excel.exe even after doing this.

Vishal



-----Original Message-----
Try
Set Excel = Nothing

I wonder if you should be using something like 'MyExcel'

instead, there
are often hidden problems with (semi-) reserved words.


---
Message posted from http://www.ExcelForum.com/

.



All times are GMT +1. The time now is 05:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com