logo
search
VBA & Macro Problems

Fix Excel Office Script Button Unshared Error After Sharing

Algirdas JasaitisAlgirdas Jasaitis Sep 28, 2026 870 views

Question details

The user needs to resolve an issue where an Excel workbook button linked to an Office Script fails and displays an 'unshared' error after the file is shared.

How to Fix Excel Office Script Button Unshared Error After Sharing
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user shares an Excel workbook that contains multiple Office Scripts and assigned buttons for automation.
Observed behavior
The assigned script runs successfully the first time, but later throws an error stating the script is unshared when clicked via the button. However, running the script directly from the code editor still works.
Before you start

Ensure that you have a stable internet connection and that all users trying to click the script buttons have the appropriate Microsoft 365 licenses and permissions to execute Office Scripts.

Solution 1Recommended

Open the Workbook Directly in Microsoft Teams App

Opening the shared file directly via the Microsoft Teams desktop app helps maintain the correct cloud sharing permissions, preventing the script from unlinking.

Office Scripts are stored in the creator's OneDrive or SharePoint. Downloading a shared workbook locally breaks the connection between the workbook buttons and the cloud-stored script, resulting in an 'unshared' error.

1
Navigate to Microsoft Teams

Launch Microsoft Teams and go to the specific channel or chat where the Excel workbook was shared.

2
Locate the Shared File

Click on the 'Files' tab at the top of the channel to find the shared Excel workbook.

3
Open in Desktop App

Click the three dots (More options) next to the file name, hover over 'Open', and select 'Open in Desktop App' instead of downloading it.

Open the Workbook Directly in Microsoft Teams App
Cloud Link Preserved: By opening the file through the Desktop App directly from Teams, Excel retains the live cloud links required for the Office Script buttons to authenticate and run.
Free Microsoft Office alternative

Try WPS Office for Reliable Macro and Automation Support

If cloud-based Office Scripts and sharing permissions are causing constant interruptions, consider switching to WPS Office. It provides robust support for traditional VBA macros without the complexity of cloud-based script sharing, ensuring your automated tasks run smoothly every time.

  1. 1. Download and Install WPS Office: Visit the official WPS website, download the free installer, and complete the quick installation process.
  2. 2. Open Your Macro-Enabled File: Launch WPS Spreadsheet and open your existing .xlsm or .xlsx workbook.
  3. 3. Enable Macros: Click on the 'Developer' tab and enable macros to execute your automated tasks flawlessly without relying on cloud permissions.
Fully compatible with Microsoft Excel (.xlsx, .xlsm) macro-enabled formats.Robust offline support for traditional VBA macros and form controls without cloud sync errors.Free, lightweight, and fast alternative to heavy cloud-based suites.Seamless migration with a highly familiar user interface.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Office Script say it is unshared when clicked from a button?

This typically occurs if the workbook was downloaded to your local drive instead of being opened directly from the cloud (like Teams or SharePoint). Downloading breaks the cloud permission link required for the script button to authenticate.

Does running the script directly from the Code Editor bypass the button error?

Yes. Running the script directly from the Code Editor executes it under your personal user credentials and bypasses the shared workbook button permissions, which is why it often works even when the button fails.

Can adding multiple scripts and buttons cause permission conflicts in Excel?

Yes, many users report that while a single script and button work seamlessly, adding multiple scripts can sometimes trigger background synchronization and sharing errors in Microsoft 365, requiring you to re-share each script manually.

Can I use VBA macros instead of Office Scripts?

Yes, traditional VBA macros do not rely on cloud-sharing permissions and are embedded directly inside the .xlsm file. Using VBA can bypass these specific cloud-sharing script errors, and VBA is fully supported in alternatives like WPS Office.