I have a case where I need to 'turn off' my UDF. When this occurs I simply want it to return whatever is now in the cell as the result of the UDF.
I've set the IsMacroType to true on the UDF - this at least lets me call GetValue() on the ExcelReference for the caller, however it always returns 0. Is there a way to get the previous result that is already in the cell and just return it as the new result?
For example, this code always returns 0 no matter what the value in the cell is before the call:
ExcelReference caller = XlCall.Excel(XlCall.xlfCaller) as ExcelReference;
if (IsSuspended)
{
return caller.GetValue();
}
Thanks,
Damon