From: Dave Burt Date: 2007-03-28T21:20:05+09:00 Subject: Re: excel is not closed in runtime using excel.Quit() Ruhul Amin wrote: > Dear Dave, > Thx for ur responce. This is my working code.I can not understand how > can I use the single Excel instance for different files. Just take WIN32OLE.new out of the loop. You can do this in a couple of ways. Both ways involve taking the WIN32OLE.new and #Quit calls out of the loop: @excel = WIN32OLE.new("Excel.Application") main_loop {|filename| read_excel(filename) } @excel.Quit @excel = nil GC.start Now, in read_excel, you can either: 1) remove the WIN32OLE::new and excel.Quit lines, and replace all "excel" with "@excel" OR 2) replace WIN32OLE::new with WIN32OLE::connect, and remove excel.Quit. Cheers, Dave