Share via


Persistable Property [Visio 2003 SDK Documentation]

Determines whether an event can potentially persist within its document.

intRet = object**.Persistable**

intRet     Integer. False (0) if the event cannot be made persistent; True (-1) if it can.

object     Required. An expression that returns an Event object.

Version added

4.1

Remarks

The Persistable property of an Event object indicates whether the event can persist, that is, whether the Event object can be stored with a Microsoft Office Visio document between executions of a program. An Event object can persist if the following conditions are true:

  1. The action code of the Event object must be visActCodeRunAddon. If the action code is visActCodeAdvise, the event won't persist and must be re-created by a program at run time.
  2. The source object must be capable of containing persistent events in its EventList collection. The source object's PersistsEvents property indicates whether it can contain persistent events. The only source objects currently capable of containing persistent events are Document, Master, and Page objects.

If these conditions are met, any of the following events are persistable:

  • BeforeMasterDelete
  • BeforePageDelete
  • BeforeShapeDelete
  • DocumentOpened
  • DocumentCreated
  • MasterAdded
  • PageAdded

Although an Event object's Persistable property indicates whether an event can persist, its Persistent property indicates whether that event actually persists. When an Event object is first created, its Persistent property is set to the same value as its Persistable property. That is, a persistable event's Persistent property is set to True, and a nonpersistable event's Persistent property is set to False.

A nonpersistent event exists as long as a reference is held on the Event object, the EventList object that contains the Event object, or the source object that has the EventList object. When the last reference to any of these objects is released, the nonpersistent event ceases to exist.

You can change the initial setting for a persistable event by setting its Persistent property to False. In this case, the event doesn't persist with its document, even though it could. However, you cannot change the Persistent property of a nonpersistent event; attempting to do so will cause an exception.

Note  Events handled in a Microsoft Visual Basic for Applications (VBA) project are persistent.

Applies to | Event object

See Also | EventList collection | Persistent property | PersistsEvents property