Hyperlink.SubAddress property (Visio)

Gets or sets the subaddress in a shape's Hyperlink object. Read/write.

Syntax

expression.SubAddress

expression A variable that represents a Hyperlink object.

Return value

String

Remarks

Setting the SubAddress property of a shape's Hyperlink object is optional unless the Address property is blank. In this case the SubAddress must contain the name of the drawing page.

Setting a hyperlink's SubAddress property is equivalent to entering information in the Sub-address box in the Hyperlinks dialog box (on the Insert tab, click Hyperlink). This is also equivalent to setting the result of the SubAddress cell in the shape's Hyperlink. name row in the ShapeSheet window.

The SubAddress property for a Hyperlink object specifies a sublocation within the hyperlink's address. For Microsoft Visio files, this can be a page name. For Microsoft Excel, this can be a worksheet or a range on a worksheet. For HTML pages, this can be a subanchor.

The hyperlink address for which a subaddress is being supplied must support subaddress linking.

Example

The following example shows how to use the SubAddress property to set the subaddress of a hyperlink. Before running this macro, replace drive\ folder\subfolder with a valid path on your computer, replace address with a valid Internet or intranet address, replace subaddress with a valid subaddress for the Internet or intranet address, replace drawing.vsd with a valid file on your computer, and replace anchor with a valid page and shape in the file.

 
Sub SubAddress_Example() 
 
 Dim vsoShape As Visio.Shape 
 Dim vsoHyperlink As Visio.Hyperlink 
 
 'Draw a rectangle shape on the active page. 
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1) 
 
 'Add a hyperlink to the shape. 
 Set vsoHyperlink = vsoShape.AddHyperlink 
 
 'Allow relative hyperlink addresses. 
 ActiveDocument.HyperlinkBase = "drive:\folder\subfolder " 
 
 'Return a relative address. 
 vsoHyperlink.Address = "..\drawing.vsd " 
 
 'Return a relative subaddress. 
 vsoHyperlink.SubAddress = "anchor " 
 
 'Print the resulting URLs to the Debug window 
 'to show how the relative path is derived 
 'from the base path and the difference 
 'between canonical and noncanonical forms. 
 Debug.Print vsoHyperlink.CreateURL(False) 
 Debug.Print vsoHyperlink.CreateURL(True) 
 
 'Return an absolute address. 
 vsoHyperlink.Address = "https://address " 
 
 'Return an absolute subaddress. 
 vsoHyperlink.SubAddress = "../subaddress " 
 
 'Print the resulting URL to the Debug window 
 Debug.Print vsoHyperlink.CreateURL(False) 
 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.