Shared Runtime

When running Excel on Windows or Mac, your add-in will run code for ribbon buttons, custom functions, and the task pane in separate JavaScript runtime environments.
This creates limitations such as not being able to easily share global data, and not being able to access all CORS functionality from a custom function.

link - 
link -
link -
link -

not currently sharing with dialogs ??

Shared Runtime 1.1

Only available in Excel
Only available in PowerPoint (currently in Preview)
Not available in Word

Benefits of a Shared Runtime

Your add-in will have a shared DOM that the ribbon, task pane, and custom functions can all access.
Your custom functions will have full CORS (Cross Origin Resource Sharing) support.
Your custom functions can call Office.js APIs to read spreadsheet document data.
Your add-in can run code as soon as the document is opened.
Your add-in can continue running code after the task pane is closed.
You can't use Visual Studio Code to debug custom functions in Excel on Windows at the moment.


Remove the CustomFunctionsRuntime requirement if it is present.
Don't add the SharedRuntime requirement set to the manifest for a Word add-in. It will cause an error when loading the add-in which is a known issue at this time.

    <Sets DefaultMinVersion="1.1">
      <Set Name="SharedRuntime" MinVersion="1.1"/>

Runtime Element

In the VersionOverrides section add a <Runtimes> element.
Change the Runtime resid to be "SharedRuntime.Url" and the lifetime to be "long".

    <Host xsi:type="Workbook">
      <Runtime resid="SharedRuntime.Url" lifetime="long" />

<long> - Starting your add-in when the document opens. Continuing to run code after the task pane has closed. Using CORS and DOM from custom functions.
<short> - This is the default. The runtime will only start when a ribbon button is pressed or a task pane is opened. The runtime might stop after a ribbon handler or after a task pane is closed.

Consistent URL

In the VersionOverrides section find the <AllFormFactors> element.
Change SourceLocation resid for the <Page> to be "SharedRuntime.Url".

<ExtensionPoint xsi:type="CustomFunctions"> 
    <SourceLocation resid="SharedRuntime.Url"/>

In the VersionOverrides section find the <DesktopFormFactor> element.
Change the FunctionFile resid to be "SharedRuntime.Url".

  <FunctionFile resid="SharedRuntime.Url" />

In the VersionOverrides section find the <Action> element.
Change the SourceLocation resid to be "SharedRuntime.Url".

<Action xsi:type="ShowTaskpane"> 
    <SourceLocation resid="URL_Taskpane1"/>

In the VersionOverrides section find the <Urls> element.
Add a new item for SharedRuntime.Url.

  <bt:Url id="SharedRuntime.Url" DefaultValue="https://localhost:3000/dist/taskpane.html" />

Multiple Task Panes

Don't design your add-in to use multiple task panes if you are planning to use a shared runtime.
A shared runtime only supports the use of one task pane.
Note that any task pane without a <TaskpaneID> is considered a different task pane.

Simple Shared Runtime

<?xml version="1.0" encoding="UTF-8"?> 

  <ProviderName>Better Solutions Limited</ProviderName>
  <DisplayName DefaultValue="ExcelJSAddIn1" />
  <Description DefaultValue="ExcelJSAddIn1"/>
  <SupportUrl DefaultValue=""/>
    <Sets DefaultMinVersion="1.1">
      <Set Name="SharedRuntime" MinVersion="1.1" />
    <SourceLocation DefaultValue="http://localhost:8080/index.html" />
<VersionOverrides xmlns="" xsi:type="VersionOverridesV1_0">
    <Host xsi:type = "Workbook">
         <Runtime resid="SharedRuntime.Url" lifetime="long" />
         <FunctionFile resid="SharedRuntime.Url"/>
      <bt:Url id="SharedRuntime.Url" DefaultValue="http://localhost:8080/index.html"/>

© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext