logo
search
File Sharing Problems

How to Make OneDrive Links Open Word and Excel Files in Desktop Apps

Maira MehtabMaira Mehtab Sep 21, 2026 868 views

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.
Before you start

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.

Solution 1Recommended

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.

1
Open the Target Document

Launch Word or Excel and open the destination file (the document you want the link to open).

2
Access the VBA Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.

3
Insert a New Module

Click 'Insert' in the top menu bar, then select 'Module' to open a blank coding window.

4
Add the File Path Code

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.

5
Run the Macro

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.

6
Insert the Hyperlink

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.

Manual Alternative: If you prefer not to use macros, you can open File Explorer, locate the target file in your OneDrive folder, hold the Shift key, right-click the file, and select 'Copy as path'. Paste this into the hyperlink address box.
Free Microsoft Office alternative

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. 1. Install WPS Office: Download and install WPS Office for free on your computer.
  2. 2. Open Your Files: Launch WPS Writer or Spreadsheet and open your existing Word or Excel documents.
  3. 3. Add Direct Links: Select your text, press Ctrl + K, and choose your local files directly to create stable desktop-only links.
Fully compatible with Microsoft Word (.docx), Excel (.xlsx), and PowerPoint formats.Intuitive hyperlink insertion for local files without forcing unwanted web browser redirects.Lightweight architecture that runs smoothly on almost any PC or Mac.Free to download with a highly familiar user interface for immediate productivity.
microsoft office alternative - wps office

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.