Share via


href Property

Returns or sets a String that represents the URL associated with a hyperlink. The href property corresponds to the href attribute of an A element.

expression.href

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Remarks

Hyperlinks are A elements with the href attribute and are members of the element collection returned by using the links property. Bookmarks are A elements with the name attribute and are members of the element collection returned by using the anchors property.

Example

The following example sets the href attribute to "http://www.microsoft.com" for the first A element in the active document.

ActiveDocument.body.all.tags("a").Item(0).href = "http://www.microsoft.com"

Applies to | FPHTMLAnchorElement Object | FPHTMLAreaElement Object | FPHTMLBaseElement Object | FPHTMLImg Object | FPHTMLLinkElement Object | FPHTMLLocation Object | FPHTMLStyleSheet Object | IHTMLAnchorElement Object | IHTMLAreaElement Object | IHTMLBaseElement Object | IHTMLImgElement Object | IHTMLLinkElement Object | IHTMLLocation Object | IHTMLStyleSheet Object