XLL UDF is called prematurely when parameter is range containing formulas

Add-in Express™ Support Service
That's what is more important than anything else

XLL UDF is called prematurely when parameter is range containing formulas
Works when AcceptAsArray=True, fails when AcceptAsArray=False 
David Jones




Posts: 39
Joined: 2012-10-15
Thanks, Sergey. That seems to have fixed the problem.

Can you explain what this setting does? There doesn't seem to be much information in the docs. What are the other side effects of changing this?

Thank again

David
Posted 10 Jun, 2013 07:20:15 Top
David Jones




Posts: 39
Joined: 2012-10-15
Hi Sergey

Contrary to my last post this has not fixed the problem. I'm calling a lot of worksheet functions to examine cell values and style info e.g.


string cellFormattedValue = Convert.ToString(_Module.CallWorksheetFunction(ADXExcelWorksheetFunction.GetCell, new object[] { 53, currentCell }));


and they are now all returning xlReturnInvXlFn.

Is there any way around this without changing the IsMacro setting?

Thanks

David
Posted 10 Jun, 2013 08:35:46 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
David, I reproduced the same issue using the C++ example from the XLL SDK for Excel 2010. Sometimes all functions work properly with IsMacro = true. But once I move an Add-in Express or SDK function to another cell, I get a wrong value. If IsMacro = false, I don't see such strange behavior.
Posted 10 Jun, 2013 11:09:23 Top
David Jones




Posts: 39
Joined: 2012-10-15
Thanks for looking into this, Sergey. We have to set IsMacro=True for this function because we need to use the worksheet functions.

So... we are going to follow Andrei's initial suggestion of using a trigger parameter. So the user will have to pass the range to the function twice and we will set AcceptAsArray=True for one range and AcceptAsArray=False for the other.
Posted 11 Jun, 2013 12:51:45 Top