Hi,
I have developed a Excel Add-in using Excel-DNA version 0.30 with a couple of User Defined functions(UDF).
In all the UDFs i basically fetch data from a webservice and populate the results.
In some of the UDFs the data fetched is large and hence i make this request through a macro using ExcelAsyncUtil.QueueAsMacro rather
than make the web request using HttpWebRequest from the UDF.
My question : "Is there a way to stop the execution of a UDF once it has been called?"
Below is the scenario for which i am considering stopping the UDF execution.
The user realizes that the intended parameters were not passed and
wants to stop the execution of the UDF.
I have referred the posts below but i am not sure whether what i am trying to achieve is feasible.
http://www.decisionmodels.com/calcsecretsh.htm
The link http://www.decisionmodels.com/calcsecretsh.htm mentions that one can control the users ability to interrupt calculation by
specifying what will interrupt the calculation.
Application.CalculationInterruptKey= XlAnyKey | XLEscKey | XlNokey.
I tried putting the below code
_excelApplication = (Microsoft.Office.Interop.Excel.Application)ExcelDnaUtil.Application;
_excelApplication.CalculationInterruptKey = XlCalculationInterruptKey.xlAnyKey;
in AutoOpen() and checked if pressing any key during calculation stops the execution but it doesn't.
Anyone has some idea on how this can be achieved please let me know.
Thanks,
Arjun