我有以下代码,在替换超链接时似乎不起作用:
Sub ReplacePartHyperlinkAddress()
Dim hLink As Hyperlink
Dim wSheet As Worksheet
For Each wSheet In Worksheets
For Each hLink In wSheet.Hyperlinks
hLink.Address = Replace(hLink.Address, "File:///C:\Users/username/AppData/roaming", "O:\Brisbane\Brisbane_Groups\Offices")
Next hLink
Next wSheet
End Sub
有人可以帮我解决这个问题,我也许会尝试以不正确的方式执行它。
答案 0 :(得分:0)
旧链接从File:///
开始,您还应该让您的新网络(网络)驱动器位置以此开头:
hLink.Address = Replace(hLink.Address, "File:///C:\Users/username/AppData/roaming", _
"File:///O:\Brisbane\Brisbane_Groups\Offices")
此外,我认为您的初始链接看起来很奇怪,因为当我创建链接时,路径中的所有斜杠都是向后“\”:"File:///C:\Users\username\AppData\roaming"