Persistent property

Microsoft Visio Developer Reference

Persistent property

   Example   

Determines whether or not an event persists with its document.

Version added

4.1

Syntax

intRet = object.Persistent
object.Persistent = intExpression

intRet

Integer. False (0) if the event won't be saved with the document; True (-1) if it will.

object

Required. An expression that returns an Event object.

intExpression

Required Integer. False (0) to make the event nonpersistent; True (non-zero) to make it persistent.

Remarks

An event is persistable if its action code is visActCodeRunAddon and the event's source object is capable of containing persistent events.

When an event is first created, its Persistent property is set to the same value as its Persistable property; if an event can persist, Visio assumes it should persist. You can change the initial setting for a persistable event by setting its Persistent property to False. However, you cannot change the Persistent property of a nonpersistable event—attempting to do so causes an exception.

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.

A persistent event exists until its Event object is deleted from the source object's EventList collection.

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