Excel Cannot Save Macro Enabled Workbook to SharePoint: Fix
🔍 WiseChecker

Excel Cannot Save Macro Enabled Workbook to SharePoint: Fix

You cannot save a macro-enabled workbook (.xlsm) to SharePoint from Excel. The save operation fails with a generic error or the file remains read-only. This happens because SharePoint blocks files containing VBA code by default to prevent security risks. This article explains why SharePoint blocks .xlsm files and provides specific steps to unblock and save your workbook successfully.

Key Takeaways: Saving .xlsm Files to SharePoint

  • SharePoint Admin Center > Policies > File type blocking: Disable the block on .xlsm files at the tenant level to allow saving.
  • File > Options > Trust Center > Trust Center Settings > Macro Settings: Enable all macros or digitally sign your macros to avoid block triggers.
  • Save As > Browse > Check in to SharePoint: Use manual check-in if the file is checked out to resolve save conflicts.

ADVERTISEMENT

Why SharePoint Blocks Macro-Enabled Workbooks

SharePoint applies file type blocking policies to prevent users from uploading or saving files that contain executable code. Macro-enabled workbooks (.xlsm) are classified as executable because they can contain VBA code that runs on the client machine. The default SharePoint security policy blocks file extensions such as .xlsm, .xlam, and .xla. This block applies to all document libraries unless a SharePoint administrator explicitly removes the extension from the blocked list.

The block occurs at two levels: the SharePoint tenant-wide file type block list and the individual document library settings. Even if the tenant policy allows .xlsm files, a library-specific setting may still block them. Additionally, if the workbook is opened from SharePoint in Excel and the user attempts to save changes, Excel may trigger a save conflict because the file is checked out to the current user but the block prevents the save operation from completing.

How the Block Manifests in Excel

When you try to save a macro-enabled workbook to SharePoint, you may see one of these errors:

  • “Your changes could not be saved to [filename] because of a sharing violation.”
  • “Excel cannot save this file because it is read-only.”
  • “The file could not be checked in. The file type is blocked.”

These errors indicate that SharePoint is rejecting the file based on its extension, not that the file is corrupted.

Steps to Unblock and Save .xlsm Files to SharePoint

The fix requires changes at the SharePoint tenant level and optionally at the library level. You must be a SharePoint administrator or a site collection administrator to perform these steps. If you are not an administrator, contact your IT department.

  1. Check if the tenant blocks .xlsm files
    Sign in to the SharePoint Admin Center. Go to Policies > File type blocking. Look for the entry that includes .xlsm. If the block is enabled, you see a checkmark next to .xlsm. Click the policy name to edit it.
  2. Remove .xlsm from the blocked list
    In the file type blocking policy, uncheck the box next to .xlsm. Click Save. Wait up to 15 minutes for the policy to propagate across your tenant.
  3. Verify the document library settings
    Navigate to the specific SharePoint library where you want to save the file. Click the gear icon and choose Library settings. Under Permissions and Management, click File type blocking. Ensure .xlsm is not listed in the blocked file types box. If it is, remove it and click OK.
  4. Close and reopen Excel
    Close Excel completely. Reopen the workbook from SharePoint. This refreshes the connection and applies the updated policy.
  5. Save the workbook using Save As
    In Excel, click File > Save As. Choose the SharePoint library as the location. If the file already exists, you may need to overwrite it. Click Save. If you receive a check-in prompt, click Check In to complete the save.
  6. If save still fails, check out the file manually
    In the SharePoint library, select the file and click Check Out. Open the file from the library, make changes, then click File > Save. After saving, click Check In from the library menu. This bypasses the block if the file is already in the library but was blocked for updates.

Alternative: Save as a Different Format

If you cannot change SharePoint policies, save the workbook as a non-macro format. Use File > Save As and choose .xlsx (Excel Workbook). This removes all macros. You lose the VBA code but the file saves to SharePoint without error. This is a temporary workaround only.

ADVERTISEMENT

If Excel Still Has Issues After Unblocking

Even after unblocking .xlsm files, you may encounter other save failures. The following issues are common.

Excel Says File Is Read-Only When Saving to SharePoint

This occurs when the file is checked out to another user or the file is in a library that requires check-out. Open the file from SharePoint. If you see a yellow banner that says “This file is checked out to you,” click the banner and choose Edit. If another user has the file checked out, ask them to check in the file. If the library requires check-out, you must manually check out the file before editing.

Save Fails With Sharing Violation Error

A sharing violation means another process is using the file. Close all other Excel instances. Ensure no other user has the file open in edit mode. On the SharePoint library page, click the three dots next to the file and choose Open in App. This forces Excel to open the file directly rather than through the browser.

Macros Are Disabled After Uploading to SharePoint

SharePoint may strip macros from the file if the library has a policy that removes active content. Go to the SharePoint library settings. Under Permissions and Management, click Active content settings. Choose Allow active content for this library. If you cannot change this setting, ask your administrator to allow active content at the site collection level.

Tenant Policy vs Library Policy: Key Differences

Item Tenant Policy Library Policy
Scope All SharePoint sites in the organization One specific document library
Who can change SharePoint administrator Site collection administrator or library owner
Effect on .xlsm Blocks or allows the extension across all libraries Overrides tenant policy only for that library
Propagation time Up to 15 minutes Immediate after saving settings

If the tenant policy blocks .xlsm, no library can accept the file even if the library policy allows it. You must remove the block at the tenant level first. After that, library-level settings can further restrict or allow the extension.

ADVERTISEMENT

Conclusion

You can now save macro-enabled workbooks to SharePoint by removing the .xlsm block from the tenant policy and verifying library settings. Always check the file type blocking policy in the SharePoint Admin Center before troubleshooting other save errors. For a faster fix, ask your administrator to run the PowerShell command Set-SPOTenant -ExcludedFileTypeExtensions @(".exe",".msi") to clear all blocked extensions except critical ones.

ADVERTISEMENT