How to output into Excel cell an error message directly from qlxl function call?
Posted by Andrew Kolesnikov on
URL: http://quantlib.414.s1.nabble.com/How-to-output-into-Excel-cell-an-error-message-directly-from-qlxl-function-call-tp9021.html
Hello.
I try to return an error message directly from any OPER* function. Usually, in any catch section (at the end of XLL_DEC function description) error message are logged by logError() function. So return value is 0, or #NUM in Excel cell. Is there any way to return an error message during function call, instead of usage retrieveError function (like in QLXL framework by "Display error" option)? I tried to create a local XLOPER variable in catch section, such as:
catch (const std::exception &e) {
XLOPER returnValue;
const std::string str = e.what();
ObjectHandler::scalarToOper(str, returnValue);
return &returnValue;
}
but of course it doesn't work cause the returnValue variable is local.
Thanks.