Is Excel currently showing the Formula Wizard ?
static BOOL IsInFormulaWizard( ); |
TRUE if the current add-in function is being called from the Excel Function Wizard; FALSE otherwise.
If your function is expensive to perform, or may involve user interaction, it is not a good idea to call it from the Excel Function Wizard, as it will be called each time one of the arguments is changed. You can use this function to detect the condition and return a safe, cheap result.
Since this function is static, it is not necessary to use an instance of CXllApp to invoke it. You can use code such as:
if ( CXllApp::IsInFormulaWizard()) { xloRet = xlerrNA; return xloRet.Ret(); }
You can use the XLL+ Function Wizard to generate this code for you automatically. See Do not call in Formula Wizard.
Header: xllplus.h
CXllApp Class | CXllApp Methods | Function property: DoNotCallInFormulaWizard