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

Closing an excel application

P: 25
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 having is closing down the excel application. Here some "bits" of the code I am using:

Expand|Select|Wrap|Line Numbers
  1. xlApp = Dispatch("Excel.Application")
  2.  
  3. xlApp.Workbooks.Open(Filename = path+fname)
I am closing the workbook by doing the following:

Expand|Select|Wrap|Line Numbers
  1. xlApp.Workbooks.Close()
I am trying to quit the excel application by doing the following:

Expand|Select|Wrap|Line Numbers
  1. xlApp.quit()
The problem is when I check the windows Task Manager, the EXCEL.EXE is still present. From all I have read, this is the correct way to close the workbook and exit the excel application.

Can anyone tell me what I might be doing wrong.

Thanks in advance.

Silgd1
Jul 8 '09 #1
Share this Question
Share on Google+
2 Replies


P: 25
I found out that you must do the following:

Expand|Select|Wrap|Line Numbers
  1. xlApp.Visible = 0
  2. del xlApp
you must make x1App.Visible=0 before you use del x1App, otherwise EXCEL.EXE remains in memory.
Jul 9 '09 #2

bvdet
Expert Mod 2.5K+
P: 2,851
Thanks for updating us with the solution. I am only somewhat familiar with win32com. I usually interface with Excel using CSV files.

-BV
Jul 10 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.