返回或设置一个 字符串 ,表示超链接的 URL 地址。 读/写。
语法
表达式。地址
表达 一个代表 Hyperlink 对象的变量。
返回值
字符串
示例
以下示例显示当前出版物中所有超链接的 URL 地址。
Sub ShowHyperlinkAddresses()
Dim pgsPage As Page
Dim shpShape As Shape
Dim hprLink As Hyperlink
Dim intCount As Integer
For Each pgsPage In ActiveDocument.Pages
For Each shpShape In pgsPage.Shapes
If shpShape.TextFrame.TextRange.Hyperlinks.Count > 0 Then
For Each hprLink In shpShape.TextFrame.TextRange.Hyperlinks
MsgBox "This hyperlink goes to " & hprLink.Address & "."
intCount = intCount + 1
Next hprLink
ElseIf shpShape.Hyperlink.Address <> "" Then
MsgBox "This hyperlink goes to " & shpShape.Hyperlink.Address & "."
intCount = intCount + 1
End If
Next shpShape
Next pgsPage
If intCount < 1 Then
MsgBox "You don't have any hyperlinks in your publication."
Else
MsgBox "You have " & intCount & " hyperlinks in " & ThisDocument.Name & "."
End If
End Sub
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。