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?
Asked
Active
Viewed 128 times
1
-
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 Answers
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.
- Specify the task pane to be opened automatically.
<Action xsi:type="ShowTaskpane"> <TaskpaneId>Office.AutoShowTaskpaneWithDocument</TaskpaneId> <SourceLocation resid="Contoso.Taskpane.Url" /> </Action>
- Tag the document to automatically open the task pane.
Office.context.document.settings.set("Office.AutoShowTaskpaneWithDocument", true); Office.context.document.settings.saveAsync();
- Initialize with Office.onReady()

Raymond Lu
- 2,178
- 1
- 6
- 19
-
This could work! Although, is there a way I can do this without the use of a task pane or a UI of any sort? – Harsh Patel Jun 09 '20 at 15:02
-
1Could you have a try with UI-less function, I am not sure if UI-Less function support auto-open feature – Raymond Lu Jun 09 '20 at 15:12