office-jsoffice-addins

How to pass args to a ShowTaskpane action?


I have a PPT add-in taskpane with multiple tabs. Some of them are hidden using a drop menu. I also have a custom Tab section in the Ribbon and I would like to add a button there for each tab, so when the user clicks it the corresponding tab should be selected.

Is this possible?


Solution

  • I'm sorry, but there's no way to pass parameters to an add-in command. You might try the following as a workaround. (I haven't tried this and I don't know if it will work.)
    1. Set the action type for each button to ExecuteAction instead of ShowTaskpane.
    2. Assign each button action to a different function.
    3. Each function calls the `showAsTaskpane()` method and sets focus to the desired tab in the task pane. See [Show or hide the task pane of your Office Add-in](https://learn.microsoft.com/en-us/office/dev/add-ins/develop/show-hide-add-in).