Okay,
So I'm wanting to dump some arrays into excel. The problem I am having is with the Cells object. Basically, this works (Returns "$F$5"):
Code Ruby:row = 1; column = 0 first = worksheet.Cells(5,6).Address
Where this returns a 'method_missing: Cells' Win32OLERuntimeError error:
Code Ruby:row = 1; column = 0 first = worksheet.Cells(row,column).Address
Can anyone tell me why the second example using variables does not work?
Various examples I have found while 'googling' show the use of variables, but I am unable to make it work on my machine.
Any help is always appreciated.
Thanks
Below is the full script for what it may be worth. I realized there are some things which I could do a little nicer, but one thing at a time.![]()
Code Ruby:require 'win32ole' application = WIN32OLE.new('Excel.Application') application.visible = TRUE workbook = application.Workbooks.Add(); worksheet = workbook.Worksheets(1); worksheet.visible list = [['dog', 'cat', 'human', 'car','bathroom'],['again', 'another', 'list'],['just','an','array','of','nothing','in','particular']] #read an array of arrays back into an excel document row = 1; column = 0 list.each do |array| array.each do |element| worksheet.Range("A1").offset(row,column).value = element #.offset(row,column) column += 1 end row += 1 column = 0 end first = worksheet.Cells(5,6).Address p first





.

Bookmarks