I have an ExcelDNA (VB) UDF that I am optimising using the Solver addin that comes bundled with Excel.
If I compile with IsExceptionSafe=True (to improve speed) then Solver still runs but I can't interrupt it.
The best solution I have so far is for my UDF to detect <Escape> via:
If(XlCall.Excel(XlCall.xlAbort, true)) then Exit Function
... but that is a bit ungraceful and feeds Solver an incorrect value for the interrupted iteration.
I'm not sure exacty what IsExceptionSafe=False wraps around the UDF and how it helps Solver see the xlAbort call, but whatever it is, it would be nice to be able to emulate that via something like:
If(XlCall.Excel(XlCall.xlAbort, true)) then [do something that lets Solver see the xlAbort]
Any ideas?