From: Sam Smoot Date: 2007-07-11T22:17:39+09:00 Subject: Re: win32ole: application.quit() leave process running On Jul 8, 8:19 am, Todd Burch wrote: > I'm working a lot with Excel lately in Win XP Pro. It seems EXCEL.EXE > continues to run after my script is finished. > > I have: > > xlapp = WIN32OLE.new('excel.application') > ... > xlapp.activeworkbook.close ; > xlapp.quit() ; > > I was expecting the .quit() method to end the EXCEL.EXE process. > However, Task Manger tells me it is still running. Matter of fact, > after running the script 10 times, there are 10 instances of EXCEL.EXE > running. > > My logic is simple enough that I know I am issuing the .quit(). I've > tried the .ole_free method as well, and no joy, even though it returns > "true". I've also tried: > > xlapp.sendkeys("%fx") ; # works, but EXCEL.EXE is still running > > Ideas? > > Thanks, Todd > > -- > Posted viahttp://www.ruby-forum.com/. Set xlapp.Visible = true (at least I *think* that's the param for visibility, it's been awhile). It's probably a modal dialog asking you to save or something preventing it from closing. You'll need to dismiss that first (programmatically of course). When I used to work with ruby and excel automation, I found it very helpful to debug with visibility on, set through an environment variable. So on my workstation I'd set an APP_ENV=development, and on the server I'd set APP_ENV=production, and then in my code I could just say: xlapp.Visible = ENV['APP_ENV'] == 'development'. Good Luck!