hi all,
Below is the code for manipualting excel data.
================================================
require ‘win32ole’
excelPath = “C:\vbscript\sample.xls”
application = WIN32OLE.new(‘Excel.Application’)
application.DisplayAlerts = 0
application.Workbooks.open excelPath, false, true
currentWorkSheet = application.ActiveWorkbook.Worksheets(1)
sCell = currentWorksheet.Cells
usedColumnsCount = currentWorkSheet.UsedRange.Columns.Count
usedRowsCount = currentWorkSheet.UsedRange.Rows.Count
puts “Rows= #{usedColumnsCount} cols=#{usedRowsCount}”
For this above code i get this error
Sampler.rb:7: undifined local variable or method “currentWorkSheet” for
main:Object(NameError)
I dont the reason for this error?