Distinguish RTD DisconnectData

30 views
Skip to first unread message

Suki Gill

unread,
Sep 26, 2022, 10:00:24 AM9/26/22
to Excel-DNA

Hi

I'm using Excel-DNA to setup an RTD subscription. 

I have two excel workbooks open.

Both contain the same RTD function, different topic names are used in each workbook.

Scenario 1:

                Shutdown Excel instance for workbook1.

                RTD subscription disconnects (DisconnectData()

                Shutdown Excel instance for workbook2

                RTD subscription disconnect is not called. 

                RTD ServerTerminate() is called since there are no more RTD functions being referenced.

     

Scenario 2:

                Delete cell containing RTD subscription in workbook1.

                RTD subscription disconnects (DisconnectData())

                Shutdown Excel instance for workbook2

                RTD subscription disconnect is not called. 

                RTD ServerTerminate() is called since there are no more RTD functions being referenced.


The issue, I'm unable to distinguish if the un-subscribe (DisconnectData)

is caused by user deleting RTD function from cell or the first instance of the workbook

is being closed.

 

I have a use case where I need to trap the specific case when the user deletes the RTD cell

Many thanks

.

Govert van Drimmelen

unread,
Sep 28, 2022, 2:52:15 AM9/28/22
to Excel-DNA
From the RTD server perspective, there is no way to detect why an RTD topic is disconnected.
So you would have to make some very complicated mechanism using Excel COM events, and tracking exactly what the user is editing vs. the RTD callbacks you get.
That seems like a bad idea to me.
Maybe you can redesign the interaction so that the user uses a ribbon button or similar to indicate their different intentions more explicitly.

-Govert

Suki Gill

unread,
Sep 28, 2022, 3:10:16 PM9/28/22
to Excel-DNA
Hi Govert

Thank you very much for confirming the observed behaviour. 

In my use case I have a series of line items I was trying do some automatic clean up when the user deleted one of  excel line items.

I've resorted to simply having an extra column associated with each line item where the user can indicate they want to remove the item by setting to either true/false which is a reasonable workaround. 

Many thanks for your help.

Suki




Reply all
Reply to author
Forward
0 new messages