1
我們已經遷移了服務器並使用相同的共享路徑傳輸了這些文件。我的客戶已經有一個帶有超鏈接的文字文件,它指向舊的服務器名稱。更新Word中超鏈接的一部分
即 \\serverOld\accounts\1234.pdf and \\serverNew\accounts\1234.pdf
我發現這個VB腳本低於做了什麼,我需要,但它是爲Excel不字。
Sub HyperLinkChange()
Dim oldtext As String
Dim newtext As String
Dim h As Hyperlink
' These can be any text portion of a hyperlink, such as ".com" or ".org".
oldtext = "\\topscan-server"
newtext = "\\ts-sbs"
' Check all hyperlinks on active sheet.
For Each h In ActiveSheet.Hyperlinks
x = InStr(1, h.Address, oldtext)
If x > 0 Then
If h.TextToDisplay = h.Address Then
h.TextToDisplay = newtext
End If
h.Address = Application.WorksheetFunction. _
Substitute(h.Address, oldtext, newtext)
End If
Next
End Sub
請有人可以幫我編輯這個文本來使用Microsoft Word 2010嗎?
誰曾批准上述編輯,請加「字VBA」標籤,並刪除「VS-宏」的標籤吧。謝謝。 – 2012-07-11 14:32:19