如何在Excel中更改多个超链接文件的path?

我想在Excel中一次更改多个超链接文件的path。

它们大多数是file:///F:\URL PDF\"name of file"

我想改变file:///C:\USER\Christina\Desktop\PDFs\URL PDF\"name of file"pathfile:///C:\USER\Christina\Desktop\PDFs\URL PDF\"name of file"

请注意,每个文件的每个“文件名”是不同的。

这是可能的与VBA。

每个工作表都有一个超链接集合。 每个超链接都有一个名为“地址”的属性。 这些地址是string。 对于string有一个函数Replace()。 这个函数可以用另一个replace一个子string。

ActiveWorkbook中的工作表1示例:

 With ActiveWorkbook.Worksheets(1) For Each oHyperlink In .Hyperlinks MsgBox oHyperlink.Address sNewAddress = Replace(Expression:=oHyperlink.Address, Find:="F:\URL PDF\", Replace:="C:\USER\Christina\Desktop\PDFs\URL PDF\") oHyperlink.Address = sNewAddress MsgBox oHyperlink.Address Next End With 

问候

阿克塞尔