From: djlewis Date: 2008-08-13T05:37:32+09:00 Subject: Re: WIN32OLE -- cannot terminate Excel process On Aug 12, 1:57 pm, Bryan Richardson wrote: > You could kill the excel process... not sure how clean that is though. > > Process.kill('KILL', excel.ProcessID) > > -- > Bryan > > On Tue, Aug 12, 2008 at 11:47 AM, djlewis wrote: > > I've read all the forum stuff on getting the Excel process to > > terminate. Yet the following code does not do that -- Excel.exe > > remains in task manager... > > > excel = WIN32OLE::new('excel.Application') > > ewb = excel.workbooks.add( t_path + "TTI-DB-Template.xls") > > ews = ewb.Worksheets.Item( 1) > > ews.cells(1, 1).value = "sdfasd" # comment out to make it work > > > ewb.saveas( t_path + "Temptemp3.xls") > > > # not sure I need all this, but it can't hurt (or can it?) > > ewb.Close(0) > > excel.Quit() > > WIN32OLE.ole_free( excel) > > WIN32OLE.ole_free( ewb) > > WIN32OLE.ole_free( ews) > > excel = nil > > ews = nil > > ewb = nil > > GC.start > > > However, if I remove the line: ews.cells(1, 1).value = "sdfasd", then > > the Excel process DOES go away. > > > What'd going on here? How do I get rid of the Excel process if I put > > anything into the worksheet/workbook? > > > Thanks. --David. Yup, thought of that, and will do it if I can't figure out how to terminate the process cleanly. So, how do I get the ProcessID? Thanks. --David.