Hi all,
I need to write some data to Excel and I am using Excel2000.fp to perform this task. I have not been able to write 1D arrays to a range of cells

Starting with those sample arrays:
int di[] = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 };
double dd[] = { 2.5, 4.5, 6.5, 8.5, 10.5, 12.5, 14.5, 16.5, 18.5, 20.5 };
and using excel2000dem sample as a starting point, I added these lines to WriteDataToExcel function:
// Open new Range for Worksheet
error = CA_VariantSetCString (&MyCellRangeV, "M2:M11");
error = Excel_WorksheetRange (ExcelWorksheetHandle, NULL, MyCellRangeV, CA_DEFAULT_VAL, &ExcelRangeHandle);
if (error<0) goto Error;
// Make range Active
error = Excel_RangeActivate (ExcelRangeHandle, &ErrorInfo, NULL);
if (error<0) goto Error;
//error = CA_VariantSet1DArray (&MyVariant, CAVT_DOUBLE, 10, dd);
//error = CA_VariantSet1DArray (&MyVariant, CAVT_INT, 10, di);
//error = CA_VariantSet2DArray (&MyVariant, CAVT_DOUBLE, 10, 1, dd);
//error = CA_VariantSet2DArray (&MyVariant, CAVT_INT, 10, 1, di);
// Set Range with one call passing SAFEARRAY as Variant
error = Excel_SetProperty (ExcelRangeHandle, &ErrorInfo, Excel_RangeValue2, CAVT_VARIANT, MyVariant);
if (error < 0) goto Error;
As you can see, I want to write 10 values to the sheet in a single column, either integers or doubles (I will need to treat both data types). The result of using CA_VariantSet1DArray is always 10 cells all with the value of the first element in the array!

If I use CA_VariantSet2DArray all works well even if I have defined the arrays as 10*1 elements

OK, the trick of a 2d array of 1 column only works, but what is the reason for this behaviour?