Hello James, James Tucker schrieb: > I can't replicate this: > >>> require 'win32ole' >> > [... skipping irb session ...] This is truely strange! Thanks for pointing this out! When I tried this with IRB on my machine, I got the same result: Excel termination worked normally. So there must be some difference when the is executed as a Ruby file vs. via IRB. So far, I have no idea what it could be. I have set both RUBYOPT and RUBLIB to empty strings, I've run the file via SciTe and on the console (ruby filename.rb) -- the Excel object persists under all those conditions. It's only within IRB that it is cleaned up properly. Both my Ruby186 and 185 installations were done with the one-click installer. (if that is of any significance) I would appreciate any further help on this issue. Thank you Sven > > > > > Sven Suska wrote: > >> Hello, >> >> I can't get rid of Excel, if I have ever called it, >> even with such a simple script: >> >> ---------- code starts -------------- >> require 'win32ole' >> >> def puts_win32ole_objects >> res = [] >> ObjectSpace.each_object do |o| >> res << o if o.is_a? WIN32OLE >> end >> puts res.inspect >> end >> >> puts_win32ole_objects # --> empty >> xl = WIN32OLE.new('Excel.Application') >> puts_win32ole_objects # --> one object >> xl.Quit >> xl = nil >> GC.start # anything else I could do??? >> puts_win32ole_objects # --> the object is still there >> sleep 5 >> --------------------------------------------- >> And also the Excel process remains running in Windows. >> >> Btw, even after the xl.Quit, the object remains fully functional, >> so I could call o.Visible, o.Workbooks.Open(...) etc., it o were >> the object (retrieved from ObjectSpace). >> >> When the Ruby process is terminated (after sleep), the >> Excel process will also terminate. >> >> So, what's the proper way to handle this? >> >> I've found the WIN32OLE.ole_free method, but they say >> that it is for debugging only. >> >> >> Thanks for your help >> >> Sven >> >> >> >> > > >