Time out for Excel function to return

Add-in Express™ Support Service
That's what is more important than anything else

Time out for Excel function to return
 
nwein




Posts: 510
Joined: 2011-03-28
Is it possible to limit the time Module.CallWorksheetFunction(ADXExcelWorksheetFunction.xxx) takes to return (within an XLL Module)?
I'm asking since I've noticed that if I call an external RTD (not one that I have control over), sometimes if it's in a bad state it can pretty much lock my execution and keep excel hanging indefinitely.
I'm not sure if introducing timers is a good idea but thought I'd ask first.

Thanks in advance!
Posted 27 Jan, 2017 15:55:30 Top
Andrei Smolin


Add-in Express team


Posts: 14115
Joined: 2006-05-11
Hello Nir,

When the function starts you can store the current time in a variable. In the code of the function, you can compare the current time with the time stored in the variable and decide what to do next.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 30 Jan, 2017 05:49:25 Top
nwein




Posts: 510
Joined: 2011-03-28
This is not helping since the code hangs on the CallWorksheetFunction call.
e.g.:
public static object MyUdf(string myParam)
{
	var rtdValue = Module.CallWorksheetFunction(ADXExcelWorksheetFunction.Rtd, "external.rtd", string.Empty, myParam); // <-- hangs here
	
	// do my own thing
	...	
}
Posted 30 Jan, 2017 10:42:18 Top
Andrei Smolin


Add-in Express team


Posts: 14115
Joined: 2006-05-11
Hello Nir,

If you don't have access to the code of that RTD server, there's nothing you can do about the issue.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 31 Jan, 2017 06:41:08 Top
OliverM




Posts: 144
Joined: 2015-08-13
Would it be an option to start the UDF in its own thread and cancel/abort it, if there is no response in a given time?
Kind regards
Oliver
Posted 01 Feb, 2017 04:35:29 Top
Dorel Sops




Posts: 6
Joined: 2017-01-30
Thank you for the answer, but this seems to not solve my problem. Firstly there is a office customization possible (add items from a list), which is lost, second, I cannot add my custom one click push button to reproduce the existing functionality of the browse (file open dialog). The problem is the same: I do not know the type of the "Browse" button, if this class is implemented or not. I tried to add manually a lot of kind of button type in the parent control, but no success. Please send me some details, I need them for the customer to argue what is possible and what is not (customer wants a customized open file dialog to access external repositories, but with no or minimal changes to the office UI; no changes means to capture / replace the browse button, minimal changes to add a one click button under the standard "Browse").

Does the "Browse" button has a class implemented in the add-in express or not?
If yes, which is the corresponding class, if not is this an add-in express limitation, or an office one?
If it is an ad-din express limitation, may we hope for a future version which implements it?
Posted 01 Feb, 2017 06:38:55 Top
Andrei Smolin


Add-in Express team


Posts: 14115
Joined: 2006-05-11
Hello Dorel,

Please find my response at http://www.add-in-express.com/forum/read.php?FID=5&TID=14347&MID=73527#message73527.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 01 Feb, 2017 08:09:42 Top
Andrei Smolin


Add-in Express team


Posts: 14115
Joined: 2006-05-11
Hello Oliver,

Note that a UDF is started by Excel, not by you.

Besides, Excel isn't multi-threading. There are some multi-threading features of XLL that are described. What you suggest to do isn't described and you can do this on your own risk only.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 01 Feb, 2017 08:14:06 Top