PC Review


Reply
Thread Tools Rate Thread

Closing Excel Properly

 
 
Atley
Guest
Posts: n/a
 
      10th Aug 2004
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



 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      10th Aug 2004
Hi,

xlBook.Application.Visible = False
xlBook.SaveAs(MyFileName)
xlBook.Application.Quit()
xlBook = Nothing
System.Runtime.Interopservices.marshal.releasecomobject(xlapp)
gc.collect


Ken
------------------
"Atley" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
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




 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      10th Aug 2004
On Tue, 10 Aug 2004 14:58:11 -0400, "Atley" <(E-Mail Removed)> 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 ~~~ (E-Mail Removed)
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2010 not closing files properly Steve Hayes Microsoft Excel Misc 6 26th Aug 2011 02:07 PM
IE6 not closing properly jd Windows XP Internet Explorer 5 11th Aug 2006 11:19 PM
Excel not closing files properly =?Utf-8?B?c2hlcmlkYW50?= Microsoft Excel Crashes 0 3rd Aug 2005 06:36 PM
Outlook says it's not closing properly Caaagh Microsoft Outlook Discussion 1 14th Apr 2005 05:31 PM
Excel not closing properly =?Utf-8?B?QmVu?= Microsoft Excel Discussion 0 4th Mar 2005 02:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:43 AM.