From: Martin DeMello Date: 2006-12-03T20:18:59+09:00 Subject: Re: can't sort an array On 12/3/06, chen li wrote: > ## > require 'win32ole' > excel = WIN32OLE.new('Excel.Application') > m = excel.ole_methods > p m.class > p m.sort sort_by is your friend. I don't have a windows machine handy to experiment, but say an Rows:WIN32OLE_METHOD defines a #name, you can say p m.sort_by {|i| i.name} or even m.map {|i| i.name}.sort if what you want is the names, rather than the Rows:WIN32OLE_METHOD objects themselves. Of course, if you *can* print it, it evidently defines to_s and inspect methods, so this will work: puts m.map {|i| i.to_s}.sort or puts m.map {|i| i.inspect}.sort martin