range = sheet.GetRange(cell, cell);
range = range.GetResize(COleVariant(365L),COleVariant(1L));
// fill safe array value by value....
COleSafeArray saRet;
DWORD numElements[1];
numElements[0] = 365;
saRet.Create(VT_R8, 1, numElements);
long index[1];
long k;
//Fill the Safe Array with the column's data
for (k = 0; k < 365; k++)
{
index[0] = k;
if (true)
{
double d;
d = 0.006+k;
saRet.PutElement(index, &d);
}
}
range.SetValue2(COleVariant(saRet));
saRet.Detach();
// Make Excel visible
app.SetVisible(TRUE);
// Return control of Excel to user
app.SetUserControl(TRUE);
Nope (I don't understand the suggestion, but I tried it anyway). According to the example in the link I shouldn't need the if(...) block in the first place. ARGH!!