Fix "The script cannot be saved" Error in Excel Macros and Scripts
Question details
The user is unable to save a recorded macro or script in Excel due to a system error.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Recording a macro or Office Script to automate spreadsheet tasks.
- Observed behavior
- Excel displays the error message "Something went wrong. The script cannot be saved" and fails to store the newly recorded script or macro.
Before troubleshooting, confirm whether you are recording a traditional VBA Macro or a modern cloud-based Office Script, as the permissions and file requirements differ significantly between the two.
Verify Workbook Format and Organizational Policies
Ensure your file format supports macros and that your Microsoft 365 administrator allows script execution.
Office Scripts and VBA macros require specific file types and tenant-level permissions to function correctly. If your organization restricts cloud automation, saving scripts will fail.
Go to File > Save As and ensure the "Save as type" dropdown is set to Excel Macro-Enabled Workbook (*.xlsm) if you are working with traditional VBA macros.
If you are using a corporate or school account, contact your IT administrator to confirm that "Office Scripts" is enabled for your user account within the Microsoft 365 Admin Center.
If you are using Excel on the web, ensure that your browser allows third-party cookies for Microsoft domains, as blocking them can prevent Office Scripts from authenticating and saving.

Resolve Automation Errors via Microsoft Communities
For complex Microsoft 365 configuration and Power Automate sync issues, consult Microsoft's dedicated automation communities.
Experience seamless spreadsheet management with WPS Office
Tired of complicated Microsoft 365 configurations, cloud syncing issues, and script saving errors? Switch to WPS Office, a fast, lightweight, and highly compatible alternative that offers a familiar interface and reliable tools for all your daily spreadsheet tasks.
- 1. Download WPS Office: Visit the official WPS website and download the free installation package for your operating system.
- 2. Open your existing spreadsheets: Launch WPS Spreadsheet and open your existing Excel workbooks. WPS will automatically recognize and preserve your data, formulas, and formatting.
- 3. Access developer tools: Navigate to the Developer tab to effortlessly manage and execute your local macros without relying on complex cloud script settings.

Frequently Asked Questions
What is the difference between VBA macros and Office Scripts?
VBA (Visual Basic for Applications) is a traditional, local scripting language used in desktop versions of Office. Office Scripts are modern, cloud-based TypeScript macros used in Microsoft 365 and Excel on the web, designed to work seamlessly with Power Automate.
Why does Excel say my macro cannot be saved?
This typically occurs if the workbook is not saved in a macro-enabled format (.xlsm), if your organization's IT policies restrict scripting, or if there is a synchronization error with Microsoft's cloud services when using Office Scripts.
How do I enable Office Scripts in Microsoft 365?
Office Scripts must be enabled by a tenant administrator. They can do this by logging into the Microsoft 365 Admin Center, navigating to Settings > Org settings, and toggling the Office Scripts feature on for the organization or specific groups.




