Hi folks
I have a worksheet which contains relative hyperlinks which cannot be opened by a macro unless they are absolute hyperlinks.
Currently the hyperlinks take to form:
../../../../Project_Name/etc
Now I am trying to write a macro to replace the first part (up till /Project_Name) with the beginning of the absolute path.
My current code is:
The problem here is that the absolute path is added before the "../../../../" of the relative path.
How can I modify the code such that the y = x without the "../../../../"?
i.e. the string x is split at the end of "../../../../" and only the text after it is set as the string y?
Cheers
I have a worksheet which contains relative hyperlinks which cannot be opened by a macro unless they are absolute hyperlinks.
Currently the hyperlinks take to form:
../../../../Project_Name/etc
Now I am trying to write a macro to replace the first part (up till /Project_Name) with the beginning of the absolute path.
My current code is:
Code:
Sub repair()
Set rangelink = Sheet7.Range("A1:A864")
For Each cell In rangelink
x = cell.Hyperlinks.Item(1).Address
If x Like "../../../../*" Then
cell.Value = "\\ABSOLUTE_PATH\" + x
End If
Next cell
End Sub
The problem here is that the absolute path is added before the "../../../../" of the relative path.
How can I modify the code such that the y = x without the "../../../../"?
i.e. the string x is split at the end of "../../../../" and only the text after it is set as the string y?
Cheers