Fix Excel Macro Saving JSON File to Unexpected OneDrive Path (d.docs.live.net)
Question details
The user's Excel macro generates a JSON file but saves it to a OneDrive web URL instead of the expected local desktop or folder path.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Running a VBA macro designed to export workbook data and save it as a local JSON file.
- Observed behavior
- The macro successfully executes but reports saving the file to an address starting with https://d.docs.live.net, making the file difficult to locate locally.
Ensure you have access to the VBA Editor by pressing ALT + F11, and check if your current Excel workbook is stored in a synced OneDrive folder.
Update the Hard-Coded Macro Path to a Local Directory
Change the save path in your VBA code to force Excel to save the JSON file to a specific local folder, bypassing OneDrive's cloud URL.
When an Excel workbook is saved in a OneDrive folder, using properties like 'ThisWorkbook.Path' in VBA returns the cloud URL (https://d.docs.live.net...) instead of the local C: drive path. To fix this, you must explicitly define a local path in your macro.
In Excel, press ALT + F11 to open the Microsoft Visual Basic for Applications (VBA) Editor.
In the Project Explorer panel, find the module containing your JSON export code and double-click to open it.
Find the line of code that sets the file save path. Replace any dynamic path variables (like ThisWorkbook.Path) with a direct local string, for example: strFilePath = "C:\Users\YourUsername\Documents\output.json"
Save your VBA changes, run the macro again, and check the designated local folder to confirm the .json file was created successfully.

Locate the Synced File on Your PC
If you prefer not to change the macro code, you can simply locate where OneDrive is syncing the d.docs.live.net file on your local machine.
Try WPS Office for Hassle-Free Macro Execution
Avoid confusing OneDrive sync paths with WPS Office. WPS Spreadsheet offers excellent VBA compatibility, allowing you to run your macros and save files locally by default without unexpected cloud routing. It's a lightweight, free alternative to Microsoft Excel.
- 1. Download WPS Office: Install WPS Office Free on your computer.
- 2. Open Your Macro Workbook: Launch WPS Spreadsheet and open your .xlsm file.
- 3. Run Macros Locally: Execute your VBA macros and enjoy predictable, local file saving without forced cloud synchronization.

Frequently Asked Questions
Why does my Excel macro path show d.docs.live.net?
When your Excel workbook is saved in a folder synchronized by OneDrive, Microsoft Excel treats the active path as a web URL (d.docs.live.net) rather than a local file path. Any macro using 'ThisWorkbook.Path' will output this cloud address.
Can changing Excel AutoSave settings fix the macro path?
No. Changing your Excel AutoSave settings will not correct a path that is defined or derived in the VBA macro. You must either move the workbook out of the OneDrive folder or explicitly code a local directory path in the macro.
How do I know if the JSON file was actually created?
If the macro runs without throwing an error and returns a d.docs.live.net URL, the file was successfully created in the cloud. You can find it by logging into OneDrive via a web browser or by checking your local OneDrive sync folder.




