共用方式為


XmlMappedRange.Change Event

Occurs when something changes in the XmlMappedRange control.

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

Syntax

'Declaration
Event Change As DocEvents_ChangeEventHandler
event DocEvents_ChangeEventHandler Change

Remarks

This event is raised if the XmlMappedRange control is changed by either a programmatic modification or user interaction. This event does not occur when the XmlMappedRange control changes during a recalculation.

Examples

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

Sub CustomerLastNameCell_Change(ByVal Target As Excel.Range) _
    Handles CustomerLastNameCell.Change
    Dim changedRange As String = Target.Address( _
        ReferenceStyle:=Excel.XlReferenceStyle.xlA1)
    MsgBox("The value of " & Me.Name & ":" & changedRange & _
        " has been changed.")
End Sub
private void XmlMappedRange_Change()
{
    this.CustomerLastNameCell.Change += 
        new Excel.DocEvents_ChangeEventHandler(
        CustomerLastNameCell_Change);
}

void CustomerLastNameCell_Change(Excel.Range Target)
{
    string changedRange = Target.get_Address(Excel.XlReferenceStyle.xlA1);

    MessageBox.Show("The value of " + this.Name + ":" +
        changedRange + " has been changed.");
}

.NET Framework Security

See Also

Reference

XmlMappedRange Interface

Microsoft.Office.Tools.Excel Namespace