Array formula with DisconnectData issue

181 views
Skip to first unread message

Larry Lin

unread,
Jul 8, 2015, 10:14:12 AM7/8/15
to exce...@googlegroups.com
Hi,

I got RTD DisconnectData issue with array formula in Excel 2010 sp1 and Excel 2013 32bit version on windows 7 64bit.

When I run same formulas in single cell(not array), it works fine and can see disconnectdata method invoked.
This issue causes same behavior when use ExcelAsyncUtil.

I saw the Excel 2010 RTD bug helper can handle this issue. As I think, it also will work when apply same bug helper to array RTD formulas.

Reproduce step:
1, Select a range and input a formula with reference parameter. I.e, =myrtdfunc(A1), hit ctrl+shift+enter to execute.
Here I can see the rtd ConnectData invoked, topic id for example is 1.

2, Change A1 cell value. This will make myrtdfunc rerun as a new rtd topic. I can see rtd ConnectData invoked with topic id 2.
So far is ok. User changes formula parameters and Excel looks it as a new rtd formula request.

3, As I supposed, rtd server should get DisconnectData with topic 1 invoked. But actually it is not invoked.

Only when I am at the point before step 2, I select the range and clear the myrtdfunc, then hit ctrl+shift+enter, the rtd server DisconnectData will be invoked.


Thanks,

Larry

Govert van Drimmelen

unread,
Jul 8, 2015, 5:46:13 PM7/8/15
to exce...@googlegroups.com, lej...@gmail.com
Hi Larry,

I am not able to reproduce the issue with DisconnectData on Excel 2013, using an RTD server based on the ExcelRtdServer base class.

There are some known quirks with RTD and array formulae:
* Your wrapper function may be called many times (once for each cell, and once for the whole array)
* XlCall.RTD(...) might return null for some of the intermediate calls.

Also, if you are changing the input parameters to an RTD function, the ConnectData for the new topic is called before the DisconnectData for the old topic.

I've made a small sample that you can test with: https://github.com/Excel-DNA/Samples/tree/master/RtdArrayTest
You can rebuild that project (update the Debug paths as needed), then run. Enter the formula {=RtdArrayTest(B1)} into cells A1 and A2, then check the debug output as you change cell B1.

Please let me know if I've misunderstood your issue.

-Govert

Larry Lin

unread,
Jul 10, 2015, 8:54:13 AM7/10/15
to exce...@googlegroups.com
Hi, Govert

Thank you for your example. Your example works.

Compared your code and my code, I found my code defines RTD formula as IsMacroType=true. After I changed this attribute to false, my RTD formula DisconnectData worked.

So I cannot use RTD formula as macro. Right?


Thanks,

Larry

Govert van Drimmelen

unread,
Jul 10, 2015, 8:59:43 AM7/10/15
to exce...@googlegroups.com
Hi Larry,

That's interesting - it's not something I knew of before.

-Govert
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

Govert van Drimmelen

unread,
Sep 8, 2015, 3:00:28 PM9/8/15
to Excel-DNA
Hi Larry,

This issue came up again in a recent thread.

When I tried it, the problem of DisconnectData not being called after an array formula calls the RTD function was preset even for a function marked IsMacroType=false.

Can you perhaps confirm that you have a case where the RTD topic's DisconnectData gets properly called even for an array formula?
I would like to understand better when and why it works or doesn't.

-Govert


On Friday, 10 July 2015 14:59:43 UTC+2, Govert van Drimmelen wrote:
Hi Larry,

That's interesting - it's not something I knew of before.

-Govert

-----Original Message-----
From: exce...@googlegroups.com [mailto:exceldna@googlegroups.com] On Behalf Of Larry Lin
Sent: 10 July 2015 14:54
To: exce...@googlegroups.com
Subject: [ExcelDna] Re: Array formula with DisconnectData issue

Hi, Govert

Thank you for your example. Your example works.

Compared your code and my code, I found my code defines RTD formula as IsMacroType=true. After I changed this attribute to false, my RTD formula DisconnectData worked.

So I cannot use RTD formula as macro. Right?


Thanks,

Larry

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages