Yashoda Chandrasekara
Yashoda Chandrasekara

Reputation: 89

Using both ShowTaskpane and ExecuteFunction together

How can I change (hide a part of the ribbon or use protected view) in excel add ins office.js?

<Action xsi:type="ExecuteFunction">
                    <FunctionName>toggleProtection</FunctionName>
                  </Action>
 <Action xsi:type="ShowTaskpane">
                    <TaskpaneId>ButtonId1</TaskpaneId>
                    <!-- Provide a URL resource id for the location that will be displayed on the task pane. -->
                    <SourceLocation resid="Contoso.Taskpane.Url" />
                  </Action> 

Is there anyway I can use both above together?

Upvotes: 2

Views: 502

Answers (1)

Rick Kirkham
Rick Kirkham

Reputation: 9784

If you are asking whether the same button/menu item can both open a task pane and execute a function, then I'm afraid that it not possible. The two actions would have to have the different buttons/menu items. A possible workaround is to have startup logic in the task pane that does the work of the function. The effect would be that the task pane would open and the work would be done.

UPDATE in light of OP's comment:

It is also not possible to hide or protect the buttons/menu items that you create as part of an Office JavaScript Add-in. But it would be a valuable feature. Please go to Office Developer Suggestion Box and suggest this, or vote up the suggestion if someone has already made it.

Upvotes: 1

Related Questions