Hi David,
As you point out, the only way you can currently put in place custom
exception handling is by creating UDFs that wrap the calls to your
functions in an exception handler, and translate the caught exceptions
to strings before returning a result to Excel.
ExcelDna is designed so that you could automate the generation of
these wrappers in your own library, without changing the ExcelDna
libraries. You would do this by examining your libraries using
reflection and generating dynamic methods that contain the exception
handlers. An example of generating a dynamic method and exporting this
method to Excel is included in the ExcelDna distribution in the
Samples08.dna file.
Perhaps a better way to deal with this in future would be for the
ExcelDna library to allow a custom exception processing method to be
declared or registered, and have the top-level exception handler call
this user-defined handler. The default behaviour would still be the
current handler which just returns the #VALUE error value to Excel.
However, adding this would not be on top of my to-do list, unless I
get some feedback suggesting that many users would like to see this.
Regards,
Govert
On Nov 7, 11:33 am, "
david.allga...@googlemail.com"