Ruby Problem

Hi Stef (aka stefanocheri@freenet.de [mailto:stefanocheri@freenet.de]):

You asked last Wednesday, December 11, 2002 5:34 PM:

Dear ruby-programmers,

i´m very new to ruby and i have to present a seminar paper
which includes a ruby program. But this programm doesn´t work
and i have no idea why not. Please help me:

require ‘win32ole’
ChartTypeVal = -4100

excel = WIN32OLE.new(“excel.application”)

class TestClass
def input(num1,num2,num3)
@num1=num1
@num2=num2
@num3=num3
end

attr_accessor :num1
attr_accessor :num2
attr_accessor :num3
end

ob= TestClass::new

print 'First number: ’
ob.num1=gets.to_i
print 'Second number: ’
ob.num2=gets.to_i
print 'Third number: ’
ob.num3=gets.to_i

excel[‘Visible’]=TRUE
excel.Workbooks.Add()
excel.Range(“a1”)[‘Value’]=ob.num1
excel.Range(“a2”)[‘Value’]=ob.num2
excel.Range(“a3”)[‘Value’]=ob.num3

excel.Range(“a1:a3”).Select()
excelchart=excel.Charts.Add()
excelchart[‘Type’]=ChartTypeVal

i=10
i.step(360,10) do |rot|
excelchart.rotation=rot
end

It works here like a charm… even faster than I can blink. Nice graph :wink:

C:\family\ruby>ruby -v
ruby 1.7.3 (2002-11-17) [i386-mswin32]

C:\family\ruby>ver

Microsoft Windows XP [Version 5.1.2600]
Office XP
Using Dave’s complete ruby distro for windows…