Public Sub 4_156()
Dim myRange As Range
Dim myHyps As Hyperlinks
Set myRange = Range("A1") '指定任意的单元格
Set myHyps = myRange.Hyperlinks
With myHyps
.Delete '删除已经存在的超连接
'插入指向本工作簿外部的超连接
.Add Anchor:=myRange, Address:="C:\ index.html", _
ScreenTip:="单击将开始浏览搜狐网站", _
TextToDisplay:="http://www.sohu.com/"
End With
Set myHyps = Nothing
Set myRange = Nothing
End Sub
Dim myRange As Range
Dim myHyps As Hyperlinks
Set myRange = Range("A1") '指定任意的单元格
Set myHyps = myRange.Hyperlinks
With myHyps
.Delete '删除已经存在的超连接
'插入指向本工作簿外部的超连接
.Add Anchor:=myRange, Address:="C:\ index.html", _
ScreenTip:="单击将开始浏览搜狐网站", _
TextToDisplay:="http://www.sohu.com/"
End With
Set myHyps = Nothing
Set myRange = Nothing
End Sub
本文介绍了一段使用VBA在Excel中删除指定单元格内的所有超链接,并创建指向外部网页的新超链接的代码。该脚本首先设定了目标单元格范围,接着删除了已存在的超链接,最后插入了一个指向搜狐网站的新超链接。
8291

被折叠的 条评论
为什么被折叠?



