XmlMappedRange.Selected 事件 (2007 系統)
更新:2007 年 11 月
會在選取 XmlMappedRange 控制項時發生。
命名空間: Microsoft.Office.Tools.Excel
組件: Microsoft.Office.Tools.Excel.v9.0 (在 Microsoft.Office.Tools.Excel.v9.0.dll 中)
語法
Public Event Selected As DocEvents_SelectionChangeEventHandler
Dim instance As XmlMappedRange
Dim handler As DocEvents_SelectionChangeEventHandler
AddHandler instance.Selected, handler
public event DocEvents_SelectionChangeEventHandler Selected
備註
當選取範圍變更為 XmlMappedRange 控制項時,便會引發這個事件。
範例
下列程式碼範例示範 Selected 事件的處理常式,顯示已選取的 XmlMappedRange 位址。此程式碼範例假設目前工作表包含名為 CustomerLastNameCell 的 XmlMappedRange。
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(missing, missing,
Excel.XlReferenceStyle.xlA1, missing, missing);
MessageBox.Show(this.Name + ":" + selectedRange + " was selected.");
}
使用權限
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。