COM automation in CPP question about array
Hi,
I want to do the following with automation :
* Get a cell that is containing a formula (let's call it A1).
* Resize the range to be 5 by 5
* Enter a new formula in A1 that will be an array function and output in the
new range.
I did the following :
Range range = m_pExcelApplication.GetActiveCell();
if(range != NULL)
{
Range resizedRange =
range.GetResize(_variant_t((long)5),_variant_t((lo ng)5));
lColumn = formulaRange.GetColumn();
lRow = formulaRange.GetRow();
tmp.Format("column : %u, row : %u", lColumn, lRow);
OutputDebugString(tmp); //give me "column : 5, row : 5"
resizedRange.Select();
formulaRange.SetFormulaArray(_variant_t("=myNewFor mula"));
}
But it doesn't work.
I always get the "Unable to set the FormulaArray property of the Range
class" error.
Can anybody help me?
Thanks
Nic
|