Visio) (Document.FollowHyperlink 方法

导航到任意超链接。

语法

表达式。FollowHyperlink (address, SubAddress, ExtraInfo, frame, NewWindow, res1, res2, res3)

表达式 表示 Document 对象的变量。

参数

名称 必需/可选 数据类型 说明
Address 必需 String 要导航到的地址。 如果为 Address 传递不正确或不存在的路径或文件名,则 Visio 将显示一条错误消息。
SubAddress 必需 String 要导航到的辅地址;如果不需要此信息,请传递空字符串。 例如,如果 Address 是包含多个页面的 Visio 文档的完整路径,则可以使用 SubAddress 指定页面。
ExtraInfo 可选 Variant 解析 URL 时要使用的额外 URL 请求信息。
Frame 可选 Variant 要导航到的 HTML 框架。
NewWindow 可选 Variant 指定是否要打开新的窗口。 如果传递任何非零数字或 True,则将在新的窗口中打开链接的页面。
res1 可选 Variant 未使用。
res2 可选 Variant 未使用。
res3 可选 Variant 未使用。

返回值

Nothing

注解

如果不需要为 Microsoft Visual Basic 或 Visual Basic for Applications 的一个或多个可选参数传递任何信息,请不要传递值。 在 C 或 C++ 中,请传递空的变量。

Visio 4.5 为具有以下签名的 Document 对象提供了未公开的 Hyperlink 方法:

HRESULT FollowHyperlink[in] (BSTR Target, [in] BSTR Location);

Visio 5.0 及更高版本仍支持此方法,但它已重命名为 FollowHyperlink45 :

HRESULT FollowHyperlink45[in] (BSTR Target, [in] BSTR Location);

但是,不建议使用 FollowHyperlink45 ;除非您使用的是 4.5 版,否则请改用 FollowHyperlink 。

示例

此 Microsoft Visual Basic for Applications (VBA) 宏说明如何使用 FollowHyperlink 方法导航到 Internet 上的网站并在新的浏览器窗口中查看生成的网页。 此外,还说明如何导航到计算机上当前文档的第二页和其他文档的第一页。 在运行宏之前,请用计算机 <上有效 Visio 文档的路径和文件名替换 path\filename>。

Public Sub FollowHyperlink_Example() 
 
 'Navigate to the Microsoft Web site and view the page in a new browser window. 
 ThisDocument.FollowHyperlink "https://www.microsoft.com", "", , , 1 
 
 'Navigate to the second page of the current document. 
 ThisDocument.FollowHyperlink "", "Page-2" 
 
 'Navigate to the first page of another document 
 ThisDocument.FollowHyperlink "<path\filename> ", "Page-1" 
 
End Sub

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。