Can anyone help. I am new to all this and have a problem that is simple to solve but I am stuck.
I have numerous worksheets with thumbnail images inserted and hyperlinked to the full size image. I need to edit all the hyperlinks at once as the file addresses have changed and I dont want to edit them manually.
I have found a code to run which works well (see below) which specifies the old folder structure and allows you to replace it with a new one.
my folder structure to the files is as follows:
c:\folder a\folder b\variable folder name\file name
How can i specify the variable folder names without having to alter it every time. The replace ment folder name will be the same for all the links. I am sure it is easy but my limited knowledge has failed me.
Sub UpdateHyperlinks()
Const sOldPath As String = "c:\folder a\folder b\variable folder name\"
Const sNewPath As String = "c:\folder a\folder b\new name\"
Dim sNewAddress As String
Dim hyp As Hyperlink
For Each hyp In ActiveSheet.Hyperlinks
If InStr(hyp.Address, sOldPath) <> 0 Then
sNewAddress = Replace(hyp.Address, sOldPath, sNewPath)
hyp.Address = sNewAddress
End If
Next hyp
End Sub
Bookmarks