Document.FollowHyperlink Method

Visio Automation Reference

Navigates to an arbitrary hyperlink.

Version Information
 Version Added:  Visio 5.0

Syntax

expression.FollowHyperlink(Address, SubAddress, ExtraInfo, Frame, NewWindow, res1, res2, res3)

expression   A variable that represents a Document object.

Parameters

Name Required/Optional Data Type Description
Address Required String The address to which you want to navigate. If you pass an incorrect or non-existent path or filename for Address, Visio displays an error message.
SubAddress Required String The secondary address to which you want to navigate; if you don't need this information, pass an empty string. If Address is the full path of a Visio document that contains multiple pages, for example, you can use SubAddress to specify the page.
ExtraInfo Optional Variant Extra URL request information to use in resolving the URL.
Frame Optional Variant The HTML frame to which to navigate.
NewWindow Optional Variant Specifies if a new window is to be opened. Passing any non-zero number or True opens the linked page in a new window.
res1 Optional Variant Unused.
res2 Optional Variant Unused.
res3 Optional Variant Unused.

Return Value
Nothing

Remarks

If you don't need to pass any information for one or more optional arguments, from Microsoft Visual Basic or Visual Basic for Applications, do not pass a value. From C or C++, pass an empty variant.

Visio 4.5 provided an undocumented Hyperlink method for a Document object that had the following signature:

Visual Basic for Applications
  HRESULT FollowHyperlink[in] (BSTR Target, [in] BSTR Location);

Visio 5.0 and later still support this method but it has been renamed FollowHyperlink45:

Visual Basic for Applications
  HRESULT FollowHyperlink45[in] (BSTR Target, [in] BSTR Location);

Use of FollowHyperlink45 is discouraged, however—unless you are using version 4.5, use FollowHyperlink instead.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the FollowHyperlink method to navigate to a site on the Internet and view the resulting Web page in a new browser window. It also shows how to navigate to the second page of the current document and to the first page of another document on your computer. Before running the macro, substitute the path and file name of a valid Visio document on your computer for <path\filename>.

Visual Basic for Applications
  Public Sub FollowHyperlink_Example()
'Navigate to the Microsoft Web site and view the page in a new browser window.
ThisDocument.FollowHyperlink "http://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 "<em>&lt;path\filename&gt;</em>", "Page-1"

End Sub

See Also