From: Ruhul Amin Date: 2007-03-28T20:37:31+09:00 Subject: Re: excel is not closed in runtime using excel.Quit() > The problem itself isn't immediately obvious to me, but: > 1) You haven't listed actual working code, which makes helping hard. > (what are path and title?) > 2) Why don't you reuse just a single Excel instance? > 3) In tests I've just performed against Win32OLE version 0.6.5, the > Excel process doesn't terminate until the WIN32OLE instance is garbage > collected. Try using GC.start to toast those old instances. (This may be > a new thing, and may be a bug.) > > Cheers, > Dave 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. def read_excel(file_name) destination_file_name=file_name begin excel = WIN32OLE::new('excel.Application') # create winole Object workbook = excel.Workbooks.Open("#{curdir} \\checkedfiles\\#destination_file_name}") # Open the Excel file worksheet = workbook.Worksheets(1) #get hold of the first worksheet worksheet.Select # select the worksheet title = worksheet.Range('h3')['Value'] #get value of title excel.ActiveWorkbook.Close(0) # close the workbook excel.Quit() # close Excel file excel.Quit() unless excel.nil? rescue puts "Excel file problem" excel.Quit() ensure excel.Quit() unless excel.nil? end end read_excel(file_name) # This function will be called for atleast 100 times #for 100 different files. Waiting for ur responce. Thx in advamced. Amin -- Posted via http://www.ruby-forum.com/.