hostname Property

Returns a String that represents the location or URL of a hyperlink. Corresponds to the value of the href property without the protocol.

expression.hostname

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

Remarks

Although the Object Browser says that the hosname property is read/write, if you try to set the hostname property, you will receive an error. Use the href property to specify the location or URL of a hyperlink.

Example

The following example sets the href attribute of the first hyperlink in the active document if the hostname property isn't equal to a specified URL.

Dim objLink As FPHTMLAnchorElement

Set objLink = ActiveDocument.Links.Item(0)
If objLink.hostname <> "www.microsoft.com" Then
    objLink.href = "http://www.microsoft.com"
End If

Applies to | FPHTMLAnchorElement Object | FPHTMLAreaElement Object | FPHTMLLocation Object | IHTMLAnchorElement Object | IHTMLAreaElement Object | IHTMLLocation Object