An Office service that supports add-ins to interact with objects in Office client applications.
Thank you for reaching out to the Microsoft Q&A Forum and for sharing the detailed scenario.
Based on my research and similar cases, there is currently no official Microsoft documentation that directly explains this specific behavior. However, here are some relevant points that may help clarify your questions:
- Shared Runtime vs taskpane initialization
In a Shared Runtime, custom functions, ribbon commands, and the taskpane are designed to run within the same JavaScript runtime. However, there is no documented guarantee that the runtime is fully initialized before the taskpane is opened. In practice, some cases show that custom functions may not resolve until the taskpane is loaded or another UI interaction occurs.
Reference: Configure your Office Add-in to use a shared runtime - Office Add-ins | Microsoft Learn
- Behavior of
worksheet.calculate(true)
There is no official documentation describing how Excel handles existing custom function invocations when recalculation is triggered. It is unclear whether previous invocations are canceled or continue running while new ones are issued. Custom functions are asynchronous, but their lifecycle in this context is not fully documented.
- Possible lifecycle or timing issue
Although not formally documented, similar issues have been reported where custom functions remain in a “Calculating…” or #BUSY! state until another interaction (such as opening the taskpane) occurs. This suggests the behavior may be related to runtime initialization timing rather than the function logic itself.
Reference: Excel custom functions in shared runtime display #BUSY! indefinitely until another unrelated action…
- Detecting stuck custom functions
There is currently no Office.js API or event to detect when a custom function is stuck in a calculating state. Existing worksheet events do not provide visibility into unresolved custom function executions.
Reference: Work with Events using the Excel JavaScript API - Office Add-ins | Microsoft Learn
Please note that as a moderator, this is a public peer-to-peer community forum. While we can share guidance and known behaviors, we do not have access to backend systems or tools to investigate runtime-level issues in depth.
If you need deeper insight into runtime behavior, I recommend posting a new thread on GitHub, where engineers and the Office.js community may be able to provide more targeted guidance.
Reference: Participating in a discussion - GitHub Docs.
Thank you for your patience and understanding.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.