Application.MarkerEvent Event
Visio Automation Reference |
Caused by calling the QueueMarkerEvent method.
Version Information
Version Added: Visio 5.0
Syntax
Private Sub expression_MarkerEvent(ByVal app As [IVAPPLICATION], ByVal SequenceNum As Long, ByVal ContextString As String)
expression A variable that represents an Application object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
app | Required | [IVAPPLICATION] | The active instance of Microsoft Office Visio. |
SequenceNum | Required | Long | The ordinal position of this event with respect to past events. |
ContextString | Required | String | Context string passed by the QueueMarkerEvent method. |
Remarks
Unlike other events that Visio fires, the MarkerEvent event is fired by a client program. A client program receives the MarkerEvent event only if the client program called the QueueMarkerEvent method.
By using the MarkerEvent event in conjunction with the QueueMarkerEvent method, a client program can queue an event to itself. The client program receives the MarkerEvent event after Visio fires all the events present in its event queue at the time of the QueueMarkerEvent call.
The MarkerEvent event passes both the context string that was passed by the QueueMarkerEvent method and the sequence number of the MarkerEvent event to the MarkerEvent event handler. Either of these values can be used to correlate QueueMarkerEvent calls with MarkerEvent events. In this way, a client program can distinguish events it caused from those it did not cause.
For example, a client program that changes the values of Visio cells may only want to respond to the CellChanged events that it did not cause. The client program can first call the QueueMarkerEvent method and pass a context string for later use to bracket the scope of its processing:
Visual Basic for Applications |
---|
|
Then, in the MarkerEvent event handler, the client program could use the context string passed to the QueueMarkerEvent method to identify the CellChanged events that it caused:
Visual Basic for Applications |
---|
|
If you're using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.
If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, see Event codes.
If you are handling this event from a program that receives a notification, the MarkerEvent event is one of one of a group of events that record extra information in the EventInfo property of the Application object.
The EventInfo property returns ContextString as described above. The varMoreInfo argument to VisEventProc will be empty.
Example
This example shows how to use the MarkerEvent event to mark an event in the event queue.
Paste this example code into the ThisDocument code window and then run UseMarker. The output will be displayed in the Immediate window.
Visual Basic for Applications |
---|
|
The output in the Immediate window looks like this:
Marker: I am starting...
ShapeAdded: Sheet.1
Marker: I am finished...
See Also