How to Make OneDrive Links Open Word and Excel Files in Desktop Apps
Question details
Users need a way to configure hyperlinks so that linked OneDrive documents open directly within the native desktop applications rather than launching in a web browser.
- Product
- Microsoft Word, Microsoft Excel, OneDrive
- Device & OS
- not provided
- Scenario
- Creating hyperlinks inside a document or spreadsheet to link to other files stored in a local OneDrive sync folder.
- Observed behavior
- The default hyperlink dialog inserts cloud-based URLs for OneDrive files, which causes the linked files to open in a web browser instead of the desktop application.
Ensure you have the OneDrive desktop client installed and actively syncing your files to your local hard drive, as this solution relies on referencing the local file directory.
Use a VBA Macro to Copy the Local OneDrive File Path
By retrieving the exact local path of a file rather than its cloud URL, you can force the hyperlink to launch the desktop application. This VBA macro automates the process of copying the local path, saving you from navigating folders manually.
Microsoft Office automatically converts paths within synced OneDrive folders into HTTPS URLs. To bypass this, you must explicitly use the local C:\ drive path. Since finding this manually is tedious, a quick VBA macro can copy the active document's local path to your clipboard.
Launch Word or Excel and open the destination file (the document you want the link to open).
Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
Click 'Insert' in the top menu bar, then select 'Module' to open a blank coding window.
Write a brief script to copy the file path. In Word, use 'ActiveDocument.FullName'; in Excel, use 'ActiveWorkbook.FullName'. Assign this value to the clipboard.
Press F5 or click the 'Run' button to execute the script. The local path (e.g., C:\Users\UserName\OneDrive\Document.docx) is now copied to your clipboard.
Return to your main document, highlight the text you want to link, press Ctrl + K to open the Insert Hyperlink dialog, and paste the copied path into the 'Address' box.
Edit and Link Your Files Seamlessly with WPS Office
Tired of complicated workarounds just to keep your workflow on your desktop? WPS Office is a free, lightweight alternative to Microsoft Office that manages local files and hyperlinks intuitively, ensuring your documents open exactly how you expect them to.
- 1. Install WPS Office: Download and install WPS Office for free on your computer.
- 2. Open Your Files: Launch WPS Writer or Spreadsheet and open your existing Word or Excel documents.
- 3. Add Direct Links: Select your text, press Ctrl + K, and choose your local files directly to create stable desktop-only links.

Frequently Asked Questions
Why do OneDrive links open in a web browser by default?
By default, modern Office applications convert paths for OneDrive-synced files into cloud-based HTTPS URLs. This is designed to facilitate real-time co-authoring and sharing, which defaults to launching Office for the Web in your browser.
Is there a built-in Office setting to force all links to open in the desktop app?
You can go to File > Options > Advanced > Link Handling and check 'Open supported hyperlinks to Office files in Office desktop apps'. However, this sometimes still initiates a brief browser redirect. Using the exact local 'C:\' file path completely avoids the browser.
Will these local path links work if I share the document with someone else?
No. Local links pointing to your specific 'C:\Users\[YourName]\...' directory will only work on your computer. If you plan to share the document, you must use the standard cloud-based sharing links so others have permission and access to the file.
Does this issue happen with files saved outside of OneDrive?
No, if you hyperlink to files saved in standard local folders (like your Documents or Desktop folders that are not synced to OneDrive), Office will automatically insert the local path and open the file directly in the desktop app.




