Craig Moran wrote:

> mully, thanks for the kickstart.  You had the right answer.  Here it is
> in Ruby (it's still a bubble sort):
> 
> require 'win32ole'
> 
> xl = WIN32OLE.new("excel.application")
> xl['Visible'] = true
> xl.workbooks.open("filename.xls")
> 
> sheets = xl.sheets.count
> (sheets - 1).times {
>   sheets.downto(2) { |i|
>     if xl.sheets(i).name < xl.sheets(i - 1).name
>       xl.sheets(i).activate
>       xl.sheets(i).move xl.sheets(i - 1)
>     end
>   }
> }

If there are only a few worksheets, the fact that it's a bubble sort
probably won't matter in any practical sense.

-- 
Paul Lutus
http://www.arachnoid.com