From: Samuel Williams Date: 2010-04-14T18:30:22+09:00 Subject: Re: Excel manipulation capitaliZation On 14/04/2010, at 9:25 PM, Simbolla Simbolla wrote: > 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? > -- > Posted via http://www.ruby-forum.com/. >