Recommended error to return?

May 18, 2013 at 12:40 PM
What's the recommended errortypes to return from an ExcelDna function?

I'm thinking about returning #N/A if non-optional arguments are missing, and #VALUE on exceptions (showing a popup as well).
Coordinator
May 18, 2013 at 2:26 PM
HI NIels,

I'd suggest keeping #N/A as "Not Available", mainly for async functions still busy, or for RTD functions before the first result. That would be consistent with the Excel-DNA usage.

For general errors, #VALUE is good. I'd only show a pop-up for the incorrect number of arguments, since you know that immediately and it does not depend on the values. For other exceptions, I think it's better not to interrupt the calculation, so just return #VALUE, but maybe log to a separate non-modal window that the user can display from a ribbon button.

-Govert