Updating all hyperlinks in a linked spreadsheet

henryJT

New Member
Joined
Oct 24, 2011
Messages
7
I'll start by saying, I'm not good at all with VBA - but if you have easy to follow instructions that would be great

A user of mine, has a spreadsheet with around 300 linked documents in a spreadsheet. The problem being, the documents are either on their own desktop, or a couple of other peoples. Moving to a full Win10 environment this weekend, all those links will break, since, new profiles, new desktop locations etc.
Is there a way to update all the links that will be
\\fileserver\profiles\username\desktop\folder\filename.docx

to

H:\folder\filename.docx

I was hoping I could update them all at once, copy the files to the new location and everything will be great. This is a very important document for the users and the thought of manually updating all the links when I'm already got virtually no spare time brings me to tears. Any help would be greatly appreciated!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Try running this macro on a copy of your workbook:
Code:
Public Sub ChangeHyperlinks()
    Dim ws As Worksheet
    Dim hlink As Hyperlink
    Dim p As Long
    For Each ws In ActiveWorkbook.Worksheets
        For Each hlink In ws.Hyperlinks
            p = InStrRev(hlink.Address, "\")
            If p > 0 Then
                hlink.Address = "H:\folder\" & Mid(hlink.Address, p + 1)
            End If
        Next
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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