replacing multiple Hyperlink adresses with a macro

时间:2017-12-18 06:35:05

标签: excel vba excel-vba hyperlink

my main Problem ist adressed in the following Forum-entry: (Replace part of hyperlink) with the following code:

Sub test()
Dim hLink As Hyperlink
Dim wSheet As Worksheet

For Each wSheet In Worksheets
   For Each hLink In wSheet.Hyperlinks
        hLink.Address = Replace(hLink.Address, "\\mysrv001\", "\\mysrv002\")
    Next hLink
Next
End Sub

however, I have only one worksheet so I adjusted the code to

Sub hyperlink_restoration()

Dim hLink As Hyperlink

For Each hLink In Worksheet.Hyperlinks
    hLink.Address = Replace(hLink.Address, "C:\Users\mwichert\AppData\Roaming\Microsoft\Excel", "\\srvbea1.bea.elpe\Groups\m1_sintirisis\ÐñïëçðôéêÞ ÓõíôÞñçóç\2.Ëßðáíóç åîïðëéóìïý")
Next hLink

End Sub

And I get an error 424 " object required. What am I missing ?

0 个答案:

没有答案