SubAddress Property [Visio 2003 SDK Documentation]

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

strRet = object**.SubAddress**

object**.SubAddress** = stringExpression

strRet     String. The current value of the field.

object     Required. An expression that returns a Hyperlink object.

stringExpression     Required String. The new value for the field.

Version added

5.0

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 (Insert menu). 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 Office Visio files, this can be a page name. For Microsoft Office Excel, this can be a worksheet or a range within 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 = "http://address" 

    'Return an absolute subaddress. 
    vsoHyperlink.SubAddress = "../subaddress" 

    'Print the resulting URL to the Debug window 
    Debug.Print vsoHyperlink.CreateURL(False) 

End Sub

Applies to | Hyperlink object

See Also | Address property | ExtraInfo property