WorksheetBase.FollowHyperlink Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when you click any hyperlink on a worksheet.
public:
event Microsoft::Office::Interop::Excel::DocEvents_FollowHyperlinkEventHandler ^ FollowHyperlink;
public event Microsoft.Office.Interop.Excel.DocEvents_FollowHyperlinkEventHandler FollowHyperlink;
member this.FollowHyperlink : Microsoft.Office.Interop.Excel.DocEvents_FollowHyperlinkEventHandler
Public Custom Event FollowHyperlink As DocEvents_FollowHyperlinkEventHandler
Event Type
Examples
The following code example demonstrates a handler for the FollowHyperlink event that keeps a list of all the hyperlinks in the current workbook that have been clicked, plus the names of the worksheets that contain these hyperlinks, in a ListBox control.
This example is for a document-level customization.
private ListBox listBox1;
private void WorksheetFollowHyperlink()
{
listBox1 = this.Controls.AddListBox(
this.Range["B2", "C3"], "listBox1");
this.FollowHyperlink +=
new Excel.DocEvents_FollowHyperlinkEventHandler(
Worksheet1_FollowHyperlink);
}
void Worksheet1_FollowHyperlink(Excel.Hyperlink Target)
{
listBox1.Items.Add(this.Name + ":" + Target.Address);
}
Private listBox1 As ListBox
Private Sub WorksheetFollowHyperlink()
listBox1 = Me.Controls.AddListBox(Me.Range("B2", "C3"), _
"listBox1")
End Sub
Sub Worksheet1_FollowHyperlink(ByVal Target As Excel.Hyperlink) _
Handles Me.FollowHyperlink
listBox1.Items.Add(Me.Name & ":" & Target.Address)
End Sub