Excel DNA how to get events for each minor change in spreadsheet?

1k Views Asked by At

Developing excel spreadsheet real-time sharing application I got stuck on how to get events for border change, colour change,multi cell editing etc...(used VSTO but problem still sustain...)

I tried Excel DNA for to make RTD server to get real time data to excel but how to send changes in sheet to RTD server? I am trying .net reactive extension but how to write custom events for excel spreadsheet changes?

1

There are 1 best solutions below

0
On BEST ANSWER

The COM object model that Excel provides, together with the set of events exposed by the Application, Worksheet and other objects, is the richest set of information available from Excel. VSTO, and any other type of add-in (including those built with Excel-DNA), are restricted by the same COM object model and event set exposed by Excel.

Among the COM object model events, Worksheet_SelectionChange is probably the best one to monitor for format changes. Multi cell editing should result in recalculation events.

RTD is about notification in the other direction - telling Excel that data has changed, and that it should recalculate.

There are two other mechanisms that might take you in new directions, beyond the Excel object model. The first is the undocumented mechanism used by VBA to implement the macro recorder. If anyone know anything about this mechanism, and it can be hooked or shimmed in some way, it might give you access to the stream of event recorded by VBA into the macros. The second approach would be to use the UI Automation support in Excel. With that you can monitor what happens on the screen, at the level that a screen-reader would use.