473,414 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Closing Excel Properly

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
2 2244
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: lasmit42 | last post by:
Guys I am writing a program which reads the first cell of many Excel spreadsheets and then takes some actions. The problem that I am experiencing is that each Excel instance I create persists...
7
by: rdemyan via AccessMonster.com | last post by:
I want to make sure that I'm closing an opened spreadsheet correctly. I've been having some locking up problems. The following code adds a dummy row to the spreadsheet to ensure that that the data...
2
by: ridawg | last post by:
Hey, I have some code where I open up Excel then loop through several cases to update several workbooks. Basically something like this (not showing all the code just basic structure). Try...
0
by: Jono | last post by:
Hello, I've been getting this message when closing excel (not necessarily when closing the workbook by itself, but when closing Excel and the workbook at the same time): ...
4
by: Yoduh | last post by:
Hello, I'm fairly new to javascript. I'm making a website for my personal use that will read from Excel and display some data on an HTML page and I've been learning javascript as I go. A problem...
0
by: etp | last post by:
I am using office automation to open and read an excel doc on a K2 workflow server. I get an intermittent bug where I get a pop-up error box in excel saying "Not enough system resources to display...
2
hemantbasva
by: hemantbasva | last post by:
Note We need to have a template on server for generating report in multiple sheet as we do not had msoffice on server moreover this require a batch job to delete excel file created by the...
2
by: Silgd1 | last post by:
Hi All.... I'm using python 2.4, Win XP Pro v.2002 sp3, and I use pyscripter 1.9.9.2 as my editor. I have written code to open an existing excel file and grab some data. The problem I am...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.