Поделиться через


ActionEventArgs.Range Property

Gets the range containing the text that has been recognized as a smart tag.

Smart tags are deprecated in Excel 2010 and Word 2010. You can still use the related APIs, but there is no smart tag functionality after Excel 2007 and Word 2007.

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

Syntax

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

Property Value

Type: Microsoft.Office.Interop.Word.Range
The range containing the text that has been recognized as a smart tag.

Examples

The following code example demonstrates a handler for the Click event. The event handler uses the Range property to display the start and end position of the recognized smart tag term. 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_Click(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ActionEventArgs) _
    Handles displayAddress.Click

    Dim termStart As Integer = e.Range.Start
    Dim termEnd As Integer = e.Range.End
    MsgBox("The recognized text '" & e.Text & _
            "' begins at position " & termStart & _
            " and ends at position " & termEnd)
End Sub
void displayAddress_Click(object sender,
    Microsoft.Office.Tools.Word.ActionEventArgs e)
{
    int termStart = e.Range.Start;
    int termEnd = e.Range.End;
    System.Windows.Forms.MessageBox.Show("The recognized text '" + e.Text +
        "' begins at position " + termStart.ToString() +
        " and ends at position " + termEnd.ToString());
}

.NET Framework Security

See Also

Reference

ActionEventArgs Interface

Microsoft.Office.Tools.Word Namespace