1

I want to register events at the earliest possible stage for Excel, is it possible to register those events upon starting Excel similar to how there is a Startup event in VSTO? If that isn't possible, is there a way for me to run Office.js code to register events right after the manifest has finished loading into Excel?

Harsh Patel
  • 151
  • 6
  • You may try Office.onReady()? https://learn.microsoft.com/en-us/office/dev/add-ins/develop/initialize-add-in – Raymond Lu Jun 09 '20 at 14:46
  • Does this run every time Excel is opened up with add-in already installed or is this only when the user interacts with the add-in, for example, if the user clicks a button to run a UI-less function? – Harsh Patel Jun 09 '20 at 14:53

1 Answers1

1

A solution that you may have a try. there is an auto-open feature can let task pane open automatically when a document opens. With the auto-open feature, you can explicitly define or allow the user to define whether a specific task pane add-in persists in a specific document.

  1. Specify the task pane to be opened automatically.
<Action xsi:type="ShowTaskpane">
    <TaskpaneId>Office.AutoShowTaskpaneWithDocument</TaskpaneId>
    <SourceLocation resid="Contoso.Taskpane.Url" />
</Action>
  1. Tag the document to automatically open the task pane.

Office.context.document.settings.set("Office.AutoShowTaskpaneWithDocument", true); Office.context.document.settings.saveAsync();

  1. Initialize with Office.onReady()
Raymond Lu
  • 2,178
  • 1
  • 6
  • 19