Taskpane launch on ribbon load or document created or open

please is the way to pin the task pane in word and excel. or use LaunchEvents like outlook to trigger the task pane on new document which in return reopens when the document is open. I need a function to run as soon as the ribbon loads. I tried functionFile but seem not to execute the commands.

LaunchEvents would be a good solution for these event(onbeforePrint, onDocumentCreated, onDocumentOpen, onDocumentShare, ondocumentDownload) in word and excel

The current solution requires the document to first use the add-in. Any help would be greatly appreciated.

Upvotes: 0

Views: 700

Answers (1)

Keyur Patel - MSFT
Keyur Patel - MSFT

Reputation: 804

You can configure your taskpane to show automatically in the document, by saving the following setting:

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

Then when the next time the workbook/document is opened, the taskpane would automatically open and you can run your code there. More details here: https://learn.microsoft.com/en-us/office/dev/add-ins/develop/automatically-open-a-task-pane-with-a-document

For Excel (currently), you can also configure your add-in to run code even if the taskpane is closed.

Office.addin.setStartupBehavior(Office.StartupBehavior.load);

You can find more details: https://learn.microsoft.com/en-us/office/dev/add-ins/excel/run-code-on-document-open.

Currently we don't have launch events, for that I suggest you upvote the requests on our user voice site: officespdev.uservoice.com.

thanks for posting!

Upvotes: 1

Related Questions