NamedRange.Hyperlinks Property

Definition

Gets a Hyperlinks collection that represents the hyperlinks in the NamedRange control.

public:
 property Microsoft::Office::Interop::Excel::Hyperlinks ^ Hyperlinks { Microsoft::Office::Interop::Excel::Hyperlinks ^ get(); };
public Microsoft.Office.Interop.Excel.Hyperlinks Hyperlinks { get; }
member this.Hyperlinks : Microsoft.Office.Interop.Excel.Hyperlinks
Public ReadOnly Property Hyperlinks As Hyperlinks

Property Value

A Hyperlinks collection that represents the hyperlinks in the NamedRange control.

Examples

The following code example creates a NamedRange and then uses the Hyperlinks property to add a hyperlink to the NamedRange.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange hyperlinkRange;
private void AddHyperlink()
{
    hyperlinkRange = this.Controls.AddNamedRange(
        this.Range["B4"], "hyperlinkRange");
    this.hyperlinkRange.Hyperlinks.Add(this.hyperlinkRange.Cells,
        "http://www.contoso.com", "Contoso Web Site",
        "www.contoso.com");
}
Private hyperlinkRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub AddHyperlink()
    hyperlinkRange = Me.Controls.AddNamedRange( _
        Me.Range("B4"), "hyperlinkRange")
    Me.hyperlinkRange.Hyperlinks.Add( _
        Me.hyperlinkRange.Cells, "http://www.contoso.com", , _
        "Contoso Web Site", "www.contoso.com")
End Sub

Applies to