Embedded hyperlinks to shared OneDrive folders are not working for other users.

Strugglin Exceller

New Member
Joined
Mar 9, 2021
Messages
13
Office Version
  1. 365
Platform
  1. Windows
My company uses OneDrive for all of our files. We use Excel heavily. We have a log file that logs links to other Excel files for easy access. But if I create the link, other users can't open that link even if the folders and files are shared. If someone else creates the link, I can't open it. I assume it's because the path is to my local folder where OneDrive is downloading the files too. But I would think that is the purpose of one drive. So all can access this. It appears however that Links are user-specific. I want it so others in my company can click on that link and open that file. Is there a solution to this problem?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
If you can create links using the sheet function HYPERLINK, then you can use this solution.
1. In the standard module, paste the following function:
VBA Code:
Function OneDriveFolder() As String
    Dim sPath

    sPath = Environ$("OneDriveCommercial") & "\"  'or ("OneDrive")   ' or ("OneDriveConsumer")
    OneDriveFolder = sPath
End Function
2. In the sheet you will use this way:
Excel Formula:
HYPERLINK(OneDriveFolder()&"Folder1\SubFolder\Produktion1.xlsx")
Although all users will see the account of the user who defined the HYPERLINK function (e.g. C:\Users\Artik\OneDrive - CompanyName\..., the link should work for everyone.


If you want to create links by inserting a link (from the context menu), this will require a bit of customization.
1. You create a link that references the same cell, and in the "Display text" field, enter the path to the file without the OneDrive root folder (e.g. Folder1\SubFolder\Produktion1.xlsx).
2. In the sheet module where you store document links, insert a procedure:
VBA Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    Me.Parent.FollowHyperlink OneDriveFolder() & Target.Range.Value
End Sub
3. In the standard module, use the OneDriveFolder function.

When you click on a link prepared this way, the _FollowHyperlink event will be raised. The event will build the path to the file.

Artik
 
Upvote 0
Solution
If you can create links using the sheet function HYPERLINK, then you can use this solution.
1. In the standard module, paste the following function:
VBA Code:
Function OneDriveFolder() As String
    Dim sPath

    sPath = Environ$("OneDriveCommercial") & "\"  'or ("OneDrive")   ' or ("OneDriveConsumer")
    OneDriveFolder = sPath
End Function
2. In the sheet you will use this way:
Excel Formula:
HYPERLINK(OneDriveFolder()&"Folder1\SubFolder\Produktion1.xlsx")
Although all users will see the account of the user who defined the HYPERLINK function (e.g. C:\Users\Artik\OneDrive - CompanyName\..., the link should work for everyone.


If you want to create links by inserting a link (from the context menu), this will require a bit of customization.
1. You create a link that references the same cell, and in the "Display text" field, enter the path to the file without the OneDrive root folder (e.g. Folder1\SubFolder\Produktion1.xlsx).
2. In the sheet module where you store document links, insert a procedure:
VBA Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    Me.Parent.FollowHyperlink OneDriveFolder() & Target.Range.Value
End Sub
3. In the standard module, use the OneDriveFolder function.

When you click on a link prepared this way, the _FollowHyperlink event will be raised. The event will build the path to the file.

Artik
Thank you... This is helpful.
 
Upvote 0

Forum statistics

Threads
1,223,879
Messages
6,175,148
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top