Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Can You Use Excel Macros on SharePoint?

· 5 min read · Home Tech

In this article
  1. Background
  2. How It Works
  3. How to Choose: Desktop vs. Web
  4. Common Problems
  5. Comparisons: SharePoint vs. Local Drive
  6. Costs
  7. Safety
  8. Alternatives
  9. Frequently Asked Questions

Yes, you can use Excel macros on SharePoint, but only if the workbook is opened in Excel Desktop or Excel for the web with macro support enabled; macros do not run automatically in SharePoint's browser-based viewer.

Background

SharePoint is a Microsoft platform for document management, collaboration, and workflow automation. It allows teams to store, share, and co-edit files—including Excel workbooks—with version control and permission settings. Many organizations rely on Excel macros (VBA code) to automate repetitive tasks like data cleaning, report generation, or complex calculations. When these workbooks are uploaded to SharePoint, users often assume the macros will function as they do on a local machine. However, SharePoint itself is not a computational environment; it is a file repository. Macros only execute when the file is opened in a compatible application that supports VBA.

How It Works

When an Excel workbook with macros is saved to a SharePoint document library, the file remains unchanged: the VBA code is preserved within the .xlsm (macro-enabled) file. To run the macros:

  1. Open the file from SharePoint in Excel Desktop (installed on your Windows or Mac computer).
  2. When prompted, enable macros by clicking "Enable Content" in the security warning bar.
  3. The macros will then execute as they would from any local folder.

If you open the same file in Excel for the web (via browser), macros are disabled by default. You’ll see a message: "Macros are not supported in this view. Open in Excel to use them." The file will open in read-only mode, and no automation will occur.

How to Choose: Desktop vs. Web

Your choice depends on your workflow:

  • Use Excel Desktop if your team needs full macro functionality, complex calculations, or frequent automation.
  • Use Excel for the web if users only need to view, comment, or make minor edits without running code.

For organizations requiring automation, it’s best practice to train users to always open macro-enabled files from SharePoint in Excel Desktop. You can enforce this by renaming files with .xlsm extensions and including instructions in shared documentation. Avoid saving macro files as .xlsx, as this strips VBA code during the save process.

Common Problems

Several issues commonly arise when using Excel macros with SharePoint:

  • Macros don’t run after opening: The user may have clicked "Disable Content" by accident. Always check the security warning bar when opening the file.
  • File corruption: If multiple users edit the file simultaneously in Excel for the web, the VBA module can become corrupted. Always close the file in the web app before opening in Desktop.
  • Trust center settings: Excel Desktop may block macros if the SharePoint site isn’t listed in Trusted Locations. Administrators must add the SharePoint URL (e.g., https://yourcompany.sharepoint.com) to Excel’s Trust Center > Trusted Locations.
  • Version mismatches: Macros written in Excel 2019 may fail in Excel 2016 due to deprecated functions. Test macros across target versions before deployment.

Comparisons: SharePoint vs. Local Drive

Functionality is nearly identical between a local folder and a SharePoint library when using Excel Desktop. The key differences are:

  • File locking: SharePoint allows concurrent editing with version history; local files may overwrite changes if not coordinated.
  • Security: SharePoint applies organizational permissions (e.g., read-only for contractors); local files rely on OS file permissions.
  • Backup: SharePoint automatically versions files; local files require manual backup.

However, macros behave identically in both environments—provided Excel Desktop is used and security settings allow execution.

Costs

There are no additional costs to use Excel macros on SharePoint if you already have a Microsoft 365 subscription that includes Excel Desktop (e.g., Business Standard, E3, or E5). Excel for the web is free with a Microsoft account, but does not support macros. Users without Excel Desktop cannot run macros regardless of SharePoint access. No third-party tools or add-ons are required.

Safety

Running macros from SharePoint carries the same risks as running them from any network location. VBA code can contain malicious scripts. To stay safe:

  • Only open macro-enabled files from trusted SharePoint sites.
  • Avoid enabling macros in files received via email or from unknown sources—even if they appear to come from SharePoint.
  • Administrators should configure Excel’s Trust Center to block macros from internet locations by default and allow only internal SharePoint domains.
  • Use digital signatures: Train developers to sign macros with a certificate issued by your organization’s internal PKI. Excel will then display the signer’s identity instead of a generic warning.

Alternatives

If macros aren’t feasible due to security policies or user constraints, consider these alternatives:

  • Power Automate: Use Microsoft’s workflow tool to trigger Excel actions (e.g., filter data, send emails) from SharePoint files without VBA.
  • Power Query: Import, transform, and combine data within Excel using drag-and-drop tools—no code required.
  • Excel Functions: Replace complex macros with dynamic array functions (e.g., FILTER, SORT, UNIQUE) available in Excel 365.
  • Custom web apps: Build lightweight apps using Power Apps connected to SharePoint lists for data entry and reporting.

These alternatives are more secure, easier to maintain, and compatible with Excel for the web.

Frequently Asked Questions

Can I run Excel macros from my phone using SharePoint?

No. Neither the Excel mobile app nor any browser on iOS or Android supports VBA macros. You can view and edit data in the mobile app, but macros will not execute. To run macros, you must use Excel Desktop on a Windows or macOS computer.

Why does Excel for the web say "Macros are not supported"?

Excel for the web runs in a sandboxed browser environment that does not allow execution of VBA code for security reasons. This is intentional and cannot be changed. The web version prioritizes collaboration and safety over automation features.

Do I need special permissions on SharePoint to use macros?

Not on SharePoint itself. You only need Read/Write access to the file. However, Excel Desktop on your computer must have macro execution enabled and the SharePoint site added to Trusted Locations. Your IT department may control these settings.

Can SharePoint automatically run macros when a file is uploaded?

No. SharePoint has no capability to trigger or execute VBA code. It stores files and triggers basic workflows (e.g., notifications), but cannot invoke macros. Automation must be initiated manually by a user opening the file in Excel Desktop.

What happens if I save a macro-enabled file as .xlsx on SharePoint?

Excel will warn you that macros will be removed. If you proceed, the VBA code is permanently deleted. The file will still open in Excel for the web and Desktop, but all automation will be gone. Always keep a backup .xlsm copy.

Can multiple users run macros at the same time on the same file in SharePoint?

No. Only one user can edit the file at a time in Excel Desktop. If someone else opens it while macros are running, they’ll see a "locked for editing" message. Running macros simultaneously on one file is not supported and may corrupt data.