Adds a hyperlink pointing to URL (an Internet address) to the hyperlink collection of the document. Returns the ID (the ID property) of the added hyperlink.
Applies to: Document object
[[Let] linkIDRet = ] object.AddHyperlinkToURL ( url ) |
The AddHyperlinkToURL method syntax has these parts:
Part | Description |
object | Required. An expression that returns an instance of the Document object. |
url | Required. An expression that returns a String value. Specifies the URL address of the resource to which the added hyperlink will point. |
linkIDRet | Optional. A Long type variable. |
If the hyperlink was added successfully, the AddHyperlinkToURL method returns the ID of the added hyperlink. If the hyperlink collection of the document already contains a hyperlink with the same properties, the method doesn't create a new hyperlink, but returns the ID of the identical hyperlink. In all other cases the method returns 0.
A hyperlink created with the AddHyperlinkToURL method has the cdLinkToURL type (see the LinkType property).
This example contains a document-level script. The program adds a hyperlink pointing to the ConceptDraw web site (www.conceptdraw.com) to the hyperlink collection of the document. Then the user can input the ID of the shape in the document, to which the created hyperlink will be assigned. The hyperlink is added by using the AddHyperlinkToURL method.AddHyperlinkToURL.
' Declare variables Dim shp As Shape Dim cur_page As Page Dim shapeID As Long Dim hlinkID As Long ' Add hyperlink pointing to the ConceptDraw web site to the |