SetSourceData Win32Ole Chart Excel

Hey guys!

I`m having some trouble with the method “SetSourceData”.

When I try to use the method, on this code:

require ‘win32ole’

excel = WIN32OLE::new(‘Excel.Application’)
excel.visible = true

workbook = excel.Workbooks.Open(‘C:\Users\dsanches\Desktop\Ruby

worksheet = workbook.Worksheets(‘Sheet1’)

range = worksheet.range(‘D4’).currentregion.address

chartObjectEvolution = worksheet.ChartObjects(“Evolution”).Chart

chartObjectEvolution.SetSourceData(range, nil)

It returns this error:

C:/Users/dsanches/Desktop/Ruby Scripts/Excel/HandlingCharts.rb:14:in
method_missing': (in OLE methodSetSourceData’: )
OLE error code:0 in

HRESULT error code:0x80020005
Type mismatch.
from C:/Users/dsanches/Desktop/Ruby
Scripts/Excel/HandlingCharts.rb:14:in `’

Can you help me to figure out what is causing this problem??