question

TengZhang-2592 avatar image
0 Votes"
TengZhang-2592 asked TengZhang-2592 edited

Excel Addin ExecuteFunction won't execute

I wanted to add a custom tab that opens a new page in the browser window, but nothing happened when I clicked on the tab. I feel like perhaps the path I entered it's wrong but cannot figure out. Here's my code:

 <FunctionFile resid="Functions.Url" />
           <ExtensionPoint xsi:type="PrimaryCommandSurface">
            <CustomTab id="App Annie">
               <Label resid="CommandsGroup.Label" />
                <Group id="Contoso.Tab2.Group1">
                 <Label resid="Contoso.Tab2.GroupLabel" />
                 <Icon>
                   <bt:Image size="16" resid="Contoso.TaskpaneButton.Icon" />
                   <bt:Image size="32" resid="Contoso.TaskpaneButton.Icon" />
                   <bt:Image size="80" resid="Contoso.TaskpaneButton.Icon" />
                 </Icon>
                 <Control xsi:type="Button" id="Contoso.button">
                   <Label resid="Contoso.Button.Label" />
                   <Supertip>
                     <Title resid="Contoso.Button.Label" />
                     <Description resid="Contoso.Button.Tooltip" />
                   </Supertip>
                   <Icon>
                     <bt:Image size="16" resid="Icon.16x16" />
                     <bt:Image size="32" resid="Icon.32x32" />
                     <bt:Image size="80" resid="Icon.80x80" />
                   </Icon>
                   <Action xsi:type="ExecuteFunction">
                     <FunctionName>openWebsite</FunctionName>
                   </Action>
                 </Control>
               </Group>
             </CustomTab>
           </ExtensionPoint>


here's url path:
<bt:Url id="Functions.Url" DefaultValue="https://local.companyname.com/functions.html" />

Here's the functions.js:

 /*
  * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
  * See LICENSE in the project root for license information.
  */
    
 /* global, Office, self, window */
    
 // @flow strict
 Office.onReady(() => {
     // If needed, Office.js is ready to be called
 });
    
 /**
  * Shows a notification when the add-in command is executed.
  * @param event {Office.AddinCommands.Event}
  */
 function openAA(event) {
     Office.context.ui.openBrowserWindow('https://www.google.com/');
     event.completed();
 }
 function getGlobal() {
     if (self) {
         return self;
     }
     if (window) {
         return window;
     }
     if (global) {
         return global;
     }
     return undefined;
 }
    
 const g = getGlobal();
 g.openAA = openAA;

My file structure are like below:
excel-plugin
functions
functions.html
functions.js
manifest.xml
package.json






office-addins-devoffice-scripts-excel-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers