EventInfo property

Microsoft Visio Developer Reference

EventInfo property

   Example   

Gets additional information associated with an event, if any exists.

Version added

4.0

Syntax

strRet = object.EventInfo(eventSeqNum)

strRet

String. Additional information about the event.

object

Required. An expression that returns an Application object.

eventSeqNum

Required Long; visEvtIDMostRecent (0) for information about the most recently fired event, or the sequence number of the event to examine.

Remarks

When Visio fires an event, there are a small number of events for which additional information is available. These events are BeforeDocumentSaveAs, DocumentSavedAs, EnterScope, ExitScope, MarkerEvent, ShapesDeleted, and ShapeChanged. Use the application's EventInfo property to obtain this information, when available.

The EventInfo property returns the following:

  • A string whose contents are specific to the event in question, if the event does record extra information.
  • An empty string if an event does not record extra information.
  • An error if Visio no longer has information for the specified event.

For details about the contents of the EventInfo property for an event, see the specific event topic.

If an event target queries the EventInfo property immediately after being triggered, the most recent event and the event whose sequence number was passed to the target are the same. However, if the target is an add-on implemented by an executable (EXE) file, this may not be the case because the executable file and Visio are separate tasks that aren't modal with respect to each other.

Note Event handlers that use the Microsoft Visual Basic for Applications WithEvents variable only have access to the most recent event and must use visEvtIDMostRecent.

To ensure that the information returned by the EventInfo property is associated with the same event that triggered the add-on, the executable file can pass <sequence number> as an argument to the EventInfo property. You can obtain the sequence number of an event in the following ways:

  • If the Action property of the Event object returns visActCodeRunAddon, then the command line string passed to the add-on contains a substring of the form "/eventid=<sequence number>".

Note Even though the substring is labeled with "/eventid," don't confuse the <sequence number> passed in the command line string with the ID property of the firing Event object, which identifies the Event object in its EventList collection. The number being passed is actually the firing sequence number.

  • If the Action property of the Event object returns visActCodeAdvise, the sequence number is passed as an argument to the VisEventProc procedure implemented by the target object.