Search code examples
excelweb-servicesexcel-dnaexcel-udf

Disable excel UDF calculation in "insert function" prompt


Is there any way to disable an excel UDF function (I´m currently using excel DNA library) when it is called by "insert function" prompt?

My Excel UFD function makes webservice calls and this behavior on "insert function" prompt is overloading the server (as each user typing invoke the function).

Does anybody know how to disable this function?


Solution

  • You can detect that your function is being called from the Insert Function dialog by calling ExcelDnaUtil.IsInFunctionWizard(). So you'll have something like:

    public static object SlowFunction() 
    { 
        if (ExcelDnaUtil.IsInFunctionWizard()) 
            return "!!! In Function Wizard"; 
    
        // do the real work otherwise .... 
    }