XLL+ Class Library

Avoiding the Excel Formula Wizard

If you have a function that takes a long time to calculate, you may want to avoid calculating it for the preview in the Formula Wizard. It will be called every time the user changes an argument field, which is a waste of time until the user has finished filling in all the arguments.

You can use the CXllApp::IsInFormulaWizard() method to find out if the formula is being called from the Formula Wizard.

The example shown below returns #N/A! if the it is being called from the Formula Wizard.

extern "C" __declspec( dllexport )
LPXLOPER SLOWCALC(double X, double Y)
{
    CXlOper xloResult;
//}}XLP_SRC

    if (CXllApp::IsInFormulaWizard())
        xloResult = xlerrNA;
    else
        xloResult = BigSlowFunction(X, Y);

    return xloResult.Ret();
}

Next: Automating the code >>