Fix Excel Office Script Button Unshared Error After Sharing
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.

- 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.
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.
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.
Launch Microsoft Teams and go to the specific channel or chat where the Excel workbook was shared.
Click on the 'Files' tab at the top of the channel to find the shared Excel workbook.
Click the three dots (More options) next to the file name, hover over 'Open', and select 'Open in Desktop App' instead of downloading it.

Confirm Office Script Sharing Permissions
Verify that every single script assigned to a button has been explicitly shared with the workbook.
Seek Assistance in the Office Development Community
If the issue persists after adding multiple scripts, consult Microsoft's specialized developer forums for advanced troubleshooting.
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. Download and Install WPS Office: Visit the official WPS website, download the free installer, and complete the quick installation process.
- 2. Open Your Macro-Enabled File: Launch WPS Spreadsheet and open your existing .xlsm or .xlsx workbook.
- 3. Enable Macros: Click on the 'Developer' tab and enable macros to execute your automated tasks flawlessly without relying on cloud permissions.

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.




