How to Prevent Local OneDrive Paths in Excel XLAM Add-In Formulas
Question details
The user needs a reliable way to stop Excel from prepending local OneDrive sync paths to VBA functions called from a shared XLAM add-in.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Sharing Excel templates that rely on an XLAM add-in stored on SharePoint and synchronized via OneDrive across multiple users.
- Observed behavior
- When another user opens the shared template, the custom formulas automatically change from their original state to include the first user's specific local OneDrive path, breaking the functions.
Before making changes, ensure you have administrative access to manage trusted locations in Excel and that all users have access to the same network or organization-managed path.
Deploy the XLAM File to a Consistent Network Location
Moving the add-in to a standardized network location prevents Excel from creating user-specific local OneDrive links in formulas.
Because OneDrive synchronizes SharePoint files to a local user directory (e.g., C:\Users\[Username]\OneDrive), Excel hardcodes this absolute path into the formula. Deploying the XLAM to a location identical for all users resolves this.
Create a shared network drive or organization-managed path that maps to the exact same drive letter or UNC path for all users in the organization.
Copy or move the XLAM add-in file from the OneDrive-synced SharePoint folder to this new standardized network location.
In Excel, navigate to File > Options > Trust Center > Trust Center Settings > Trusted Locations, and add the new network path.
Open your shared Excel template, re-link the formulas to the add-in at this new location via the Add-ins menu, and save the template.

Use VBA to Strip Paths on Workbook Open
If you must keep the add-in in a OneDrive-synced folder, use a VBA script to dynamically clean up the formulas when the file is opened.
Try WPS Office for Seamless Macro and VBA Compatibility
If Microsoft Excel's OneDrive synchronization quirks continue to break your shared add-in formulas, consider switching to WPS Office. It provides a highly compatible environment for your spreadsheets and VBA macros without the heavy overhead.
- 1. Download and Install: Visit the official WPS Office website to download and install the free spreadsheet software.
- 2. Enable VBA Support: Ensure you have the VBA module installed in WPS Office to support advanced macro functionalities.
- 3. Open Your Workbook: Open your .xlsm or .xlam files directly in WPS Spreadsheet and enjoy familiar functionality.

Frequently Asked Questions
Why does Excel add my local path to add-in formulas?
Excel resolves linked files, such as XLAM add-ins, to absolute file paths. When utilizing OneDrive, the synced SharePoint folder resides locally on your computer (typically on the C: drive), causing Excel to hardcode your specific user profile path into the formula.
Can I stop OneDrive from syncing the XLAM file to fix this?
Yes, you can choose to download the add-in locally instead of syncing it through OneDrive. However, if you update the add-in, you will need to manually distribute the new XLAM file to all users instead of relying on automatic cloud updates.
How do I remove the broken paths manually?
You can quickly remove the broken paths using Excel's Find and Replace feature. Press Ctrl + H, search for the local path string (e.g., 'C:\Users\Name\OneDrive\'), leave the 'Replace with' field blank, ensure it is set to look in Formulas, and click Replace All.




