BeforeSelectionDelete 事件 (Visio)Documents.BeforeSelectionDelete event (Visio)

會在刪除選取的物件之前發生。Occurs before selected objects are deleted.

語法Syntax

運算式BeforeSelectionDelete(選取專案)expression.BeforeSelectionDelete (Selection)

_運算式_代表**Documents** 物件的變數。expression A variable that represents a Documents object.

參數Parameters

名稱Name 必要/選用Required/Optional 資料類型Data type 描述Description
SelectionSelection 必要Required IVSELECTION[IVSELECTION] 將要刪除的選定物件。The selected objects that are going to be deleted.

註解Remarks

如果圖形的Type屬性是visTypeGroup (2) 或visTypePage (1), 則shape物件可以做為BeforeSelectionDelete事件的來源物件。A Shape object can serve as the source object for the BeforeSelectionDelete event if the shape's Type property is visTypeGroup (2) or visTypePage (1).

BeforeSelectionDelete事件會指出將要刪除選取的圖形。The BeforeSelectionDelete event indicates that selected shapes are about to be deleted. 無論是否有鎖定任何圖形,都會傳送此通知,不過,並不會刪除鎖定的圖形。This notification is sent whether or not any of the shapes are locked; however, locked shapes aren't deleted. 若要確定某個圖形是否已遭鎖定而無法刪除,請檢查其 LockDelete 儲存格的值。To find out if a shape is locked against deletion, check the value of its LockDelete cell.

BeforeSelectionDeleteBeforeShapeDelete事件類似于刪除圖形之前的兩個事件。The BeforeSelectionDelete and BeforeShapeDelete events are similar in that they both fire before shape(s) are deleted. 它們的運作方式與單一作業刪除多個圖形時的行為不同。They differ in how they behave when a single operation deletes several shapes. 假設下的操作會刪除三個圖案。Suppose a Cut operation deletes three shapes. BeforeShapeDelete事件會引發三次, 並作用於這三個物件。The BeforeShapeDelete event fires three times and acts on each of the three objects. BeforeSelectionDelete事件會引發一次, 而且它會作用於選取物件, 在其中會選取三個要刪除的圖形。The BeforeSelectionDelete event fires once, and it acts on a Selection object in which the three shapes that you want to delete are selected.

如果您是使用 Microsoft Visual Basic 或 Visual Basic for Applications (VBA),則本主題中的語法會描述有效處理事件的常用方式。If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

如果您想要建立自己的事件物件, 請使用**Add** 或**AddAdvise** 方法。If you want to create your own Event objects, use the Add or AddAdvise method.

若要建立可以執行附加元件的 Event 物件,可使用 Add 方法,因為它可適用於 EventList 集合。To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection.

若要建立用於接收通知的 Event 物件,則使用 AddAdvise 方法。To create an Event object that receives notification, use the AddAdvise method.

若要尋找您要建立之事件的事件程式碼, 請參閱事件代碼To find an event code for the event that you want to create, see Event codes.

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.