Office JS Excel: Event Handlers Slow to fire

luker

New Member
Joined
Jun 5, 2023
Messages
6
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi all,

I'm currently in the process of migrating functionality within excel from VBA event handlers, notably the use of worksheet change handlers, to OfficeJS and I'm having some odd performance issues which do not seem to be documented well.

The workbook itself is quite large and performance intensive, taking several real time data feeds into its calculations. VBA based event handlers have always been instantaneous and invariant to the load on the worksheet to which the change event is attached. OfficeJS event handlers have a latency between the trigger within the worksheet and the callback in officeJS being fired which appears to be a direct function of the load on the worksheet, this latency can be as high as 5 seconds despite the calculation time of the worksheet being an order of magnitude less. Shedding load within the worksheet will reduce the time proportionally.

Is there a mechanism through which events can be fired and received in officeJS prior to the sheet being recalculated or any workarounds which anyone is aware of?

Doing simple tests using the examples within scriptlab for OnChange events can reproduce the results I'm seeing if the target sheet is sufficiently performance intensive.

I have tried databinding events on ranges and these also appear to fire after the sheet has been fully recalculated. I need a mechanism to relay change events into office JS which is not so strongly tied to load on a worksheet? I'm unable to migrate if I cannot mitigate these latency issues

(Cross posted from my colleague - stack overflow)
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Officejs is asynchronous by nature, so I doubt you'll be able to pull this off with the same performance VBA has. In addition, I don't know when precisely the officejs change event fires as compared to the VBA change event. That might be different. I expect the latency to become worse if you run the workbook in a browser (though VBA events are out of the question there)
 
Upvote 0

Forum statistics

Threads
1,215,077
Messages
6,122,992
Members
449,094
Latest member
masterms

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top