Visio) (Window.PersistsEvents 屬性

會指出某個物件是否能夠在它的 EventList 集合中包含持續事件。 唯讀。

語法

運算式PersistsEvents

表達 代表 Window 物件的變數。

傳回值

整數

註解

具有 EventList 屬性的每一個物件也會有 PersistsEvents 屬性。 為了要能夠具有保存性,事件的動作代碼必須為 visActCodeRunAddon,但是該事件也必須在某個物件的 EventList 集合中 (這個物件的 PersistsEvents 屬性為 True)。 目前會保存事件的物件只有 DocumentMasterPage 物件。

可保存的事件是否會實際執行保存需視其 Persistent 屬性值而定。

範例

這個 Microsoft Visual Basic for Applications (VBA) 宏會示範如何使用 PersistsEvents 屬性來判斷物件是否能夠包含持續性事件。 執行宏會分別在DocumentPageWindow物件的 [即時運算] 視窗中列印 1 (True) 、1 (True) ,以及 0 (False) 。

 
Public Sub PersistsEvents_Example() 
 
 Dim vsoDocument As Visio.Document 
 
 Set vsoDocument = Documents.Add("") 
 Debug.Print vsoDocument.PersistsEvents 
 Debug.Print ActivePage.PersistsEvents 
 Debug.Print ActiveWindow.PersistsEvents 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應