共用方式為


Worksheet.FollowHyperlink 事件 (2007 系統)

更新:2007 年 11 月

會在按一下工作表的超連結時發生。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel.v9.0 (在 Microsoft.Office.Tools.Excel.v9.0.dll 中)

語法

Public Event FollowHyperlink As DocEvents_FollowHyperlinkEventHandler

Dim instance As Worksheet
Dim handler As DocEvents_FollowHyperlinkEventHandler

AddHandler instance.FollowHyperlink, handler
public event DocEvents_FollowHyperlinkEventHandler FollowHyperlink

範例

下列程式碼範例示範 FollowHyperlink 事件的處理常式,這個處理常式會將目前活頁簿中所有點選的超連結清單,以及這些超連結所在的工作表名稱都保留在 ListBox 控制項中。

這是示範文件層級自訂的範例。

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
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);
}

使用權限

請參閱

參考

Worksheet 類別

Worksheet 成員

Microsoft.Office.Tools.Excel 命名空間