From: Arup Rakshit Date: 2013-01-28T23:09:41+09:00 Subject: Re: Can we attach documents to excel columns using Ruby? Joel Pearson wrote in post #1094051: > Continued (couldn't edit, out of time) > I tried below: Dir.entries("E:\\WIPData\\Ruby").each do |f| if f == wbs.cells(rows,1).value then files_dir = File.expand_path("..", Dir.pwd) column=2 Dir.foreach(files_dir.concat("/" + f)) do |x| full_path=files_dir.concat("/" + x) wbs.oleobjects.add({ 'ClassType' => nil, 'Filename' => full_path, 'Link' => false, 'DisplayAsIcon' => false, 'IconIndex' => nil, 'IconLabel' => nil, 'IconFileName' => nil, 'Left' => nil, 'Top' => nil, 'Width' => nil, 'Height' => nil }) column = column + 1 end break end end Getting error as : E:\WIPData\Ruby\Scripts>test.rb E:/WIPData/Ruby/Scripts/test.rb:26:in `method_missing': (in OLE method `add': ) (WIN32OLERuntimeError) OLE error code:800A03EC in Microsoft Excel Cannot insert object. HRESULT error code:0x80020009 Exception occurred. from E:/WIPData/Ruby/Scripts/test.rb:26:in `block (2 levels) in
' from E:/WIPData/Ruby/Scripts/test.rb:23:in `foreach' from E:/WIPData/Ruby/Scripts/test.rb:23:in `block in
' from E:/WIPData/Ruby/Scripts/test.rb:17:in `each' from E:/WIPData/Ruby/Scripts/test.rb:17:in `
' E:\WIPData\Ruby\Scripts> -- Posted via http://www.ruby-forum.com/.