Share via


XmlMappedRange.Selected Event

Definition

Occurs when the XmlMappedRange control is selected.

public:
 event Microsoft::Office::Interop::Excel::DocEvents_SelectionChangeEventHandler ^ Selected;
event Microsoft.Office.Interop.Excel.DocEvents_SelectionChangeEventHandler Selected;
member this.Selected : Microsoft.Office.Interop.Excel.DocEvents_SelectionChangeEventHandler 
Event Selected As DocEvents_SelectionChangeEventHandler 

Event Type

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.

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

Remarks

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

Applies to