Partager via


XmlMappedRange.Selected Event

Occurs when the XmlMappedRange control is selected.

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

Syntax

'Declaration
Event Selected As DocEvents_SelectionChangeEventHandler
event DocEvents_SelectionChangeEventHandler Selected

Remarks

This event is raised when the selection changes to the XmlMappedRange control.

Examples

The following code demonstrates a handler for the Selected event that displays the address of the XmlMappedRange that was selected. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.

Sub CustomerLastNameCell_Selected(ByVal Target As Excel.Range) _
    Handles CustomerLastNameCell.Selected
    Dim selectedRange As String = Target.Address( _
        ReferenceStyle:=Excel.XlReferenceStyle.xlA1)
    MsgBox(Me.Name & ":" & selectedRange & " was selected.")
End Sub
private void XmlMappedRange_Selected()
{
    this.CustomerLastNameCell.Selected += 
        new Excel.DocEvents_SelectionChangeEventHandler(
        CustomerLastNameCell_Selected);
}

void CustomerLastNameCell_Selected(Excel.Range Target)
{
    string selectedRange = Target.get_Address(Excel.XlReferenceStyle.xlA1);

    MessageBox.Show(this.Name + ":" + selectedRange + " was selected.");
}

.NET Framework Security

See Also

Reference

XmlMappedRange Interface

Microsoft.Office.Tools.Excel Namespace