The code below, which should creates a jagged array, so that I could then paste its content to the sheet, by using the .setDataArray method, do not work.
I got the error: "BASIC runtime error. Object variable not set."
But it seems, by making some tests, that I actually have a jagged array with 9 "rows" and an one-dimensional array as each of its elements.
sub build_jagged_array()
dim my_date as date, num_rows as long, arr1(), arr2
my_date = dateserial(1994,7,1)
num_rows = 9
redim arr1(0 to num_rows-1)
for i = 0 to num_rows-1
arr2 = array(dateadd("m",i,my_date))
arr1(i) = arr2
next i
sheet = thiscomponent.getsheets.getbyname("main")
range_saida = sheet.getCellRangeByName("A20:A28")
'with the arr1 below, the setDataArray method works
'arr1 = array(array(1),array(1),array(1),array(1),array(1),array(1),array(1),array(1),array(1))
range_saida.setdataarray(arr1)
end sub
while doing my tests, I changed arr1, created by the sub above, for the following arr1, and the .setDataArray worked as expected:
arr1 = array(array(1),array(1),array(1),array(1),array(1),array(1),array(1),array(1),array(1))
Please, what is wrong with the sub above?