Action.BeforeCaptionShow Event (2007 System)
Occurs after the user clicks the smart tags icon, and before the smart tag menu is displayed.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
Public Event BeforeCaptionShow As BeforeCaptionShowEventHandler
'Usage
Dim instance As Action
Dim handler As BeforeCaptionShowEventHandler
AddHandler instance.BeforeCaptionShow, handler
public event BeforeCaptionShowEventHandler BeforeCaptionShow
public:
event BeforeCaptionShowEventHandler^ BeforeCaptionShow {
void add (BeforeCaptionShowEventHandler^ value);
void remove (BeforeCaptionShowEventHandler^ value);
}
JScript does not support events.
Remarks
This event gives you an opportunity to change the smart tag caption based on context.
For more information about handling events, see Consuming Events.
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 class.
This example is for a document-level customization.
Private Sub DisplayAddress_BeforeCaptionShow(ByVal sender As Object, _
ByVal e As Microsoft.Office.Tools.Word.ActionEventArgs) _
Handles displayAddress.BeforeCaptionShow
Dim clickedAction As Microsoft.Office.Tools.Word.Action = _
TryCast(sender, Microsoft.Office.Tools.Word.Action)
If clickedAction IsNot Nothing Then
clickedAction.Caption = "Display the location of " & e.Text
End If
End Sub
void displayAddress_BeforeCaptionShow(object sender,
Microsoft.Office.Tools.Word.ActionEventArgs e)
{
Microsoft.Office.Tools.Word.Action clickedAction =
sender as Microsoft.Office.Tools.Word.Action;
if (clickedAction != null)
{
clickedAction.Caption = "Display the location of " +
e.Text;
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.