By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,678 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,678 IT Pros & Developers. It's quick & easy.

Closing Excel Properly

P: n/a
I have written an application that exports data from SQL to Excel.

It all works perfectly except that if you open the Task Manager after
running my application, there is an instance of Excel in the list for each
time the extract has been run.

I cannot seem to find anything on this, I have the application closing
properly as far as I can see, but it is staying in the process table and the
only way to get rid of it is to either reboot the machine or open the taks
manger and remove each process individually neither of which is acceptable.

here is my Excel closing code, what am I doing incorrectly here?

xlBook.Application.Visible = False
xlBook.SaveAs(MyFileName)
xlBook.Application.Quit()
xlBook = Nothing
xlApp = Nothing
any help is greatly appreciated...

Thanks

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

xlBook.Application.Visible = False
xlBook.SaveAs(MyFileName)
xlBook.Application.Quit()
xlBook = Nothing
System.Runtime.Interopservices.marshal.releasecomo bject(xlapp)
gc.collect
Ken
------------------
"Atley" <at*****@homtmail.com> wrote in message
news:Ow**************@TK2MSFTNGP10.phx.gbl...
I have written an application that exports data from SQL to Excel.

It all works perfectly except that if you open the Task Manager after
running my application, there is an instance of Excel in the list for each
time the extract has been run.

I cannot seem to find anything on this, I have the application closing
properly as far as I can see, but it is staying in the process table and the
only way to get rid of it is to either reboot the machine or open the taks
manger and remove each process individually neither of which is acceptable.

here is my Excel closing code, what am I doing incorrectly here?

xlBook.Application.Visible = False
xlBook.SaveAs(MyFileName)
xlBook.Application.Quit()
xlBook = Nothing
xlApp = Nothing
any help is greatly appreciated...

Thanks


Nov 21 '05 #2

P: n/a
On Tue, 10 Aug 2004 14:58:11 -0400, "Atley" <at*****@homtmail.com> wrote:

I have written an application that exports data from SQL to Excel.

It all works perfectly except that if you open the Task Manager after
running my application, there is an instance of Excel in the list for each
time the extract has been run.

I cannot seem to find anything on this, I have the application closing
properly as far as I can see, but it is staying in the process table and the
only way to get rid of it is to either reboot the machine or open the taks
manger and remove each process individually neither of which is acceptable.

here is my Excel closing code, what am I doing incorrectly here?

xlBook.Application.Visible = False
xlBook.SaveAs(MyFileName)
xlBook.Application.Quit()
xlBook = Nothing
xlApp = Nothing


See if the following helps:

PRB: Office Application Does Not Quit After Automation from Visual Studio .NET Client
http://support.microsoft.com/default...b;EN-US;317109
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.