Hi,
I'm looking for a way to have one of my functions behave non-volatile, however to calculate once with the first recalculation of the worksheet they're being used on.
[ExcelFunction(IsVolatile = true)]
public static string VolatileFunction()
{
return DateTime.Now.ToString("HH:mm:ss.fff");
}
[ExcelFunction(IsVolatile = true, IsMacroType = true)]
public static string VolatileFirstAndThenUnregister()
{
XlCall.Excel(XlCall.xlfVolatile, false);
return DateTime.Now.ToString("HH:mm:ss.fff");
}
[ExcelFunction(IsVolatile = false)]
public static string NonVolatile()
{
return DateTime.Now.ToString("HH:mm:ss.fff");
}
the way it was described, this should have come close to what I'm looking for.
In practice, the VolatileFunction behaves as expected, the NonVolatile function does as well, but the VolatileFirstAndThenUnregister function does not at all - it just behaves exactly like the NonVolatile function. That is, e.g. when saving a worksheet with all 3 of them, restarting excel and loading up the worksheet again, the VolatileFirstAndThenUnregister function (as well as the NonVolatile function of course) does not recalculate at all, while the VolatileFunction does.
Given this was suggested in a past post - did anything change? In the way these are registered, or maybe in the way modern Excel versions are handling this? I'm using Excel 2014 (64bit).
Thanks!