An alternative method of implementing the CXllApp::IsInFormulaWizard() method uses the XLL+ Function Wizard.
In the XLL+ Function Wizard, check the Function - Disabled in Excel Formula Wizard menu item, as shown below:
This will generate code like the following:
// Function: SLOWCALC2
// Purpose: Avoid using the Formula Wizard
//{{XLP_SRC(SLOWCALC2)
// NOTE - the FunctionWizard will add and remove mapping code here.
// DO NOT EDIT what you see in these blocks of generated code!
IMPLEMENT_XLLFN2(SLOWCALC2, "RBB", "SLOWCALC2", "X,Y", "User Defi"
"ned", "Avoid using the Formula Wizard", "No description prov"
"ided\000No description provided\000", "\0\0nopreview=1\0",
1)
extern "C" __declspec( dllexport )
LPXLOPER SLOWCALC2(double X, double Y)
{
if (CXllApp::IsInFormulaWizard())
return CXlOper::RetError(xlerrNA);
CXlOper xloResult;
//}}XLP_SRC
// TODO - Set the value of xloResult
return xloResult.Ret();
}