Share via


Action.BeforeCaptionShow Event

Occurs after the user clicks the smart tags icon, and before the smart tag menu is displayed.

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

Syntax

'Declaration
Event BeforeCaptionShow As BeforeCaptionShowEventHandler
event BeforeCaptionShowEventHandler BeforeCaptionShow

Remarks

This event gives you an opportunity to change the smart tag caption based on context.

Examples

The following code example demonstrates a handler for the BeforeCaptionShow event. The event handler modifies the menu caption of the action. This code example is part of a larger example provided for the Action interface.

This example is for a document-level customization.

Private Sub DisplayAddress_BeforeCaptionShow(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Excel.ActionEventArgs) _
    Handles DisplayAddress.BeforeCaptionShow

    Dim clickedAction As Microsoft.Office.Tools.Excel.Action = _
        TryCast(sender, Microsoft.Office.Tools.Excel.Action)

    If clickedAction IsNot Nothing Then
        clickedAction.Caption = "Display the address of " & e.Text
    End If
End Sub
void DisplayAddress_BeforeCaptionShow(object sender, 
    Microsoft.Office.Tools.Excel.ActionEventArgs e)
{
    Microsoft.Office.Tools.Excel.Action clickedAction =
        sender as Microsoft.Office.Tools.Excel.Action;

    if (clickedAction != null)
    {
        clickedAction.Caption = "Display the address of " +
            e.Text;
    }
}

.NET Framework Security

See Also

Reference

Action Interface

Microsoft.Office.Tools.Excel Namespace