How to Run a Word Macro Template from SharePoint Online
Question details
The user needs to easily run a macro-enabled Word template (.dotm) directly from a SharePoint Online communication site.

- Product
- SharePoint Online
- Device & OS
- not provided
- Scenario
- Attempting to open and execute a macro-enabled Word template (.dotm) hosted on a SharePoint site with as few clicks as possible.
- Observed behavior
- Macros (such as AutoNew or AutoOpen) fail to trigger when the template is opened in Word for the web browser, although they function correctly in the desktop application.
Ensure you have a desktop version of a word processor that supports VBA installed, as web browsers cannot execute macro code.
Open the Template in the Word Desktop Application
Bypass the browser limitations by opening the SharePoint file directly in the desktop app.
Word for the web allows viewing of macro-enabled templates (.dotm), but it is incapable of running VBA macros. To utilize user forms or automated scripts, the file must be opened natively on your desktop application.
Open your company's SharePoint communication site and locate the macro-enabled template in the document library.
Click the three vertical dots (ellipsis) next to the template's file name to open the context menu.
Select 'Open', then click on 'Open in app' (or 'Open in Desktop App') to launch the file in your local Word client.
Once the application opens, click the 'Enable Content' button on the yellow security warning bar to allow the AutoOpen or AutoNew macros to run.
Run Macro-Enabled Documents with WPS Office
Since web browsers cannot run VBA macros, a robust desktop application is required. WPS Office offers a highly compatible alternative to Microsoft Word, supporting VBA macros and seamlessly handling .docm and .dotm formats for free.
- 1. Download the template: Download the macro-enabled template (.dotm) from SharePoint to your local computer.
- 2. Open WPS Writer: Launch the WPS Office desktop application and select WPS Writer.
- 3. Enable and run: Open the downloaded template. When prompted, enable macros to utilize the document's built-in automation features.

Frequently Asked Questions
Why do my AutoNew macros fail in Word for the web?
Word for the web is built for basic document viewing and editing. It lacks the underlying architecture required to run VBA scripts, meaning macros like AutoNew or AutoOpen will only trigger in a desktop application.
Can I force SharePoint to always open files in the desktop app?
Yes. If you have administrator privileges, go to the Document Library Settings, click on Advanced Settings, and change the 'Opening Documents in the Browser' default setting to 'Open in the client application'.
Do macro-enabled templates work if shared via OneDrive?
The same browser limitations apply to OneDrive. Files opened in Word for the web via OneDrive will not run macros. You must open them in the desktop application to execute VBA code.




