NamedRange.Hyperlinks Property

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

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)

Syntax

'Declaration
ReadOnly Property Hyperlinks As Hyperlinks
Hyperlinks Hyperlinks { get; }

Property Value

Type: Hyperlinks
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.

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, "https://www.contoso.com", , _
        "Contoso Web Site", "www.contoso.com")
End Sub
Microsoft.Office.Tools.Excel.NamedRange hyperlinkRange;
private void AddHyperlink()
{
    hyperlinkRange = this.Controls.AddNamedRange(
        this.Range["B4"], "hyperlinkRange");
    this.hyperlinkRange.Hyperlinks.Add(this.hyperlinkRange.Cells,
        "https://www.contoso.com", "Contoso Web Site",
        "www.contoso.com");
}

.NET Framework Security

See Also

Reference

NamedRange Interface

Microsoft.Office.Tools.Excel Namespace