Class Hyperlink (Excel VBA)

The class Hyperlink represents a hyperlink.

Class Shape gives access to class Hyperlink.

Member in collection


To use a Hyperlink class variable it first needs to be instantiated, for example

Dim hyp as Hyperlink
Set hyp = ActiveCell.Hyperlinks(Index:=1)

The following procedures can be used to set variables of type Hyperlink: Hyperlinks.Add, Hyperlinks.Item and Shape.Hyperlink.

For Each

Here is an example of processing the Hyperlink items in a collection.

Dim hyp As Hyperlink
For Each hyp In ActiveCell.Hyperlinks
Next hyp

AddToFavorites - Adds a shortcut to the workbook or hyperlink to the Favorites folder.

CreateNewDocument - Creates a new document linked to the specified hyperlink.

Delete - Deletes the object.

Follow - Displays a cached document, if it's already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.

Hyperlinks.Add - Adds a hyperlink to the specified range or shape.

Hyperlinks.Delete - Deletes the object.


Hyperlinks.Item (Default member) - Returns a single object from a collection.

Address returns or sets a String value that represents the address of the target document.

EmailSubject returns or sets the text string of the specified hyperlink's email subject line. The subject line is appended to the hyperlink's address.

Name returns a String value that represents the name of the object.

Range returns a Range object that represents the range that the specified hyperlink is attached to.

ScreenTip returns or sets the ScreenTip text for the specified hyperlink.

Shape returns a Shape object that represents the shape attached to the specified hyperlink.

SubAddress returns or sets the location within the document associated with the hyperlink.

TextToDisplay returns or sets the text to be displayed for the specified hyperlink. The default value is the address of the hyperlink.

Type returns a Long value, containing an MsoHyperlinkType constant, that represents the location of the HTML frame.

Hyperlinks.Count returns a Long value that represents the number of objects in the collection.

Range - Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3D range.

Shape - Represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.