logo
search
SharePoint Document Issues

How to Use Local Paths with SharePoint and OneDrive Office Files

Phi Hung VoPhi Hung Vo Oct 10, 2026 869 views

Question details

Users need a way to force Microsoft Office applications, macros, and Power Query connections to use traditional local absolute paths instead of SharePoint URLs for files synced via OneDrive.

How to Use Local Paths with SharePoint and OneDrive Files
Product
Microsoft Office, SharePoint, OneDrive
Device & OS
not provided
Scenario
Running macros, updating Power Query connections, or linking reports to files that are stored in SharePoint or synchronized through OneDrive.
Observed behavior
Office applications default to cloud-aware paths (SharePoint URLs) instead of traditional local paths. This breaks existing macros, external file links, and Power Query connections that rely on absolute local file paths, and there is no global setting to disable this behavior without breaking collaboration.
Before you start

Before modifying file paths, syncing settings, or VBA macros, ensure that all open Office documents are fully saved and backed up to a local drive to prevent accidental data loss during the transition.

Solution 1Recommended

Adapt Macros and Power Query for Cloud Paths

Since forcing local paths globally is not supported, the most reliable long-term solution is adapting your VBA code and data connections to natively support SharePoint or OneDrive URLs.

Microsoft Office prioritizes cloud URLs to enable AutoSave and real-time co-authoring. Rather than fighting the system by forcing local paths, updating your scripts and queries to recognize HTTP paths ensures stability across all users in your organization.

1
Identify the cloud file location

Open the file in your Office desktop app, click on 'File' > 'Info', and click 'Copy Path' to get the exact SharePoint or OneDrive URL.

2
Update VBA Macros

Modify your VBA code that relies on 'ActiveWorkbook.Path' to check if the path starts with 'https://'. If it does, use string manipulation to convert the URL format back to a recognizable local path structure, or rewrite the macro to execute directly via the web URL.

3
Modify Power Query connections

Open Excel and navigate to 'Data' > 'Get Data' > 'From Other Sources' > 'From Web'. Paste the SharePoint URL (removing '?web=1' at the end if present) to establish a direct cloud connection instead of using a local file path.

Adapt Macros and Power Query for Cloud Paths
Future-Proofing: Updating your connections to use cloud URLs ensures your files remain fully collaborative without path conflicts when shared among different users.
Free Microsoft Office alternative

Try WPS Office for Simplified Local File Management

Dealing with forced cloud paths and broken macros in Microsoft Office can be highly frustrating. If you do not require real-time cloud co-authoring, WPS Office offers a lightweight and highly compatible alternative. It respects traditional local absolute file paths, making it vastly easier to manage your documents, spreadsheets, and presentations offline without unexpected cloud syncing overrides.

  1. 1. Download and Install: Get the free WPS Office suite from the official website and install it on your device.
  2. 2. Open Local Files: Launch WPS Office and directly open your existing locally synced folders without URLs hijacking the paths.
  3. 3. Enjoy Offline Reliability: Edit your documents and run your local workflows securely without interference from unwanted cloud sync settings.
Respects and maintains traditional local file paths without forced cloud URL overrides.Fully compatible with Microsoft Office formats including .docx, .xlsx, and .pptx.Lightweight installation with a familiar UI, allowing for a seamless migration.Free to use with powerful offline capabilities and reliable macro support.
microsoft office alternative - wps office

Frequently Asked Questions

Why does ActiveWorkbook.Path return a URL instead of a local path?

When AutoSave is enabled and a file is synced via OneDrive or SharePoint, Office treats the file natively as a cloud document. Consequently, VBA commands like ActiveWorkbook.Path return the SharePoint or OneDrive URL (https://...) instead of the local C:\ drive path.

Is there a global switch to force local paths in Microsoft Office?

No. Microsoft currently does not provide a supported global setting to force all Office applications, macros, and Power Queries to revert to traditional local absolute paths while simultaneously maintaining cloud collaboration features like AutoSave.

How can I make my Excel macros work with OneDrive synced folders?

You can update your VBA code to dynamically replace the OneDrive URL prefix with the local environment path using the Environ("USERPROFILE") command, or you can rewrite the macro logic to execute directly via the cloud URL.

Will turning off OneDrive sync fix my macro path errors?

Disabling OneDrive's 'File Collaboration' setting can temporarily force Office to use local paths, but this is only a workaround. Doing so will disable AutoSave, prevent real-time collaboration with colleagues, and may cause severe version control issues.