How to Run Macros from an Excel File Stored on a NAS Server
Question details
The user needs to execute macros within an Excel workbook stored on a Network Attached Storage (NAS) or network share, which are currently being blocked by Microsoft Excel security settings.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Opening and running a macro-enabled Excel workbook that is hosted remotely on a NAS server or a shared network drive.
- Observed behavior
- Excel's default security measures block the macros from running when the file is opened directly from a network location, preventing automation scripts from executing.
Ensure that the NAS server or network share is fully controlled and explicitly trusted by your organization to prevent the execution of malicious or unauthorized VBA code.
Add the NAS Network Path to Excel's Trusted Locations
Configure Excel's Trust Center to recognize your NAS server as a safe environment, which will allow macros in those directories to run without security warnings.
By default, Excel applies stricter security protocols to files opened from a network location or the internet. To bypass these restrictions for approved directories, you must manually add the specific NAS path to your Trusted Locations list.
Launch Excel, click on the 'File' tab in the top-left corner, and select 'Options'. From the left-hand pane of the Excel Options window, click on 'Trust Center', then click the 'Trust Center Settings' button.
In the Trust Center window, select 'Trusted Locations' from the left menu. At the bottom of this pane, check the box labeled 'Allow Trusted Locations on my network (not recommended)'. This step is mandatory before adding a NAS path.
Click the 'Add new location' button. Type the approved network path of your NAS share (for example, \\NAS-Server\SharedFolder\). If your macro files are inside subfolders, check the 'Subfolders of this location are also trusted' box.
Click 'OK' on all open dialog boxes to save your new security settings. Restart Excel and open your file from the NAS to run the macros seamlessly.

Experience Seamless Macro Compatibility with WPS Office
Having trouble managing complex Trust Center settings and macro security in Excel? Try WPS Office. It provides robust support for VBA macros and seamless compatibility with Microsoft Excel files, all within a lightweight and free productivity suite.
- 1. Download and Install: Download WPS Office Free from the official website and follow the installation prompts.
- 2. Open Your Macro-Enabled File: Launch WPS Spreadsheet and open your .xlsm file directly from your NAS server.
- 3. Enable Macros Safely: If prompted by the top security warning bar, simply click 'Enable Macros' to run your VBA code.

Frequently Asked Questions
Why does Excel block macros from my NAS server by default?
Excel defaults to blocking macros originating from network and internet locations to protect your computer from potentially malicious code. You must explicitly tell the application that a specific network location is safe.
Is it safe to allow trusted locations on my network?
It is safe only if you or your organization's IT department fully control the NAS or network share, and strictly monitor the files placed there. Never add public or untrusted network locations to your Trust Center.
Can I bypass the trusted location setup by mapping the NAS as a local network drive?
No. Mapping the NAS to a local drive letter (such as Z:) does not automatically make it a trusted location. You still need to add either the mapped drive letter or the original UNC path to your Excel Trusted Locations.
Why is the 'Add new location' button disabled in my Excel Trust Center?
If the button is disabled, your organization has likely implemented a Group Policy that prevents standard users from manually adding new Trusted Locations. You will need to contact your IT administrator to have the path approved and added centrally.




