XmlMappedRange.Deselected Event

Occurs when selection moves from the XmlMappedRange control to an area outside of the XmlMappedRange control.

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

Syntax

'Declaration
Event Deselected As DocEvents_SelectionChangeEventHandler
event DocEvents_SelectionChangeEventHandler Deselected

Remarks

This event is raised only when the XmlMappedRange control has focus, and then focus is transferred away from the XmlMappedRange control.

Examples

The following code demonstrates a handler for the Deselected event that displays the address of the new selected range when an XmlMappedRange is deselected. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.

Sub CustomerLastNameCell_Deselected(ByVal Target As Excel.Range) _
    Handles CustomerLastNameCell.Deselected
    Dim deselectedRange As String = Target.Address( _
        ReferenceStyle:=Excel.XlReferenceStyle.xlA1)
    MsgBox("CustomerLastNameCell was deselected. " & _
        "The new selection is " & deselectedRange)
End Sub
private void XmlMappedRange_Deselected()
{
    this.CustomerLastNameCell.Deselected += 
        new Excel.DocEvents_SelectionChangeEventHandler(
        CustomerLastNameCell_Deselected);
}

void CustomerLastNameCell_Deselected(Excel.Range Target)
{
    string deselectedRange = Target.get_Address(Excel.XlReferenceStyle.xlA1);

    MessageBox.Show("CustomerLastNameCell was deselected. The new " +
        "selection is " + deselectedRange);
}

.NET Framework Security

See Also

Reference

XmlMappedRange Interface

Microsoft.Office.Tools.Excel Namespace