[python-win32] Connect to Excel via COM leaves process hanging

Karl Fast karl.fast at pobox.com
Wed Jan 26 04:40:23 CET 2005


I don't know why your code doesn't work. But I know that this does
(here I am generating a new workbook, not opening an old one).

excel = Dispatch('Excel.Application')
excel.Visible = 0
excel.Workbooks.Add()
excel.Worksheets(1).Activate()
excel.ActiveWorkbook.SaveAs(file)

...do a bunch of stuff

excel.ActiveWorkbook.Save()
excel.Quit()
del(excel)
    

>    from win32com.client import Dispatch
> 
>    #Open the sheet.
>    xl_app= Dispatch("Excel.Application")
>    xl_book= xl_app.Workbooks.Open(<filename>)
> 
>    #Close the sheet and exit the app.
>    xl_book.Close()
>    xl_app.Quit()
>    del xl_app
> 
>  This leaves 'Excel' in the process list. How can I get rid of it?




--karl
http://www.livingskies.com/



More information about the Python-win32 mailing list