Table of contents
Collapse the table of content
Expand the table of content

Application.QueueMarkerEvent Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Queues a MarkerEvent event that fires after all other queued events.


expression . QueueMarkerEvent( ContextString )

expression A variable that represents an Application object.


NameRequired/OptionalData TypeDescription
ContextStringRequiredStringAn arbitrary string that is passed with the event that fires.

Return Value



The QueueMarkerEvent method works in conjunction with the MarkerEvent event to allow an Automation client to queue an event to itself. The QueueMarkerEvent method causes the application to fire a MarkerEvent event after it has fired all the events in its event queue.

The QueueMarkerEvent method returns the sequence number of the MarkerEvent event to fire, and the string passed to the QueueMarkerEvent method (legally empty) is passed to the MarkerEvent event handler.

A client program can use either the sequence number or the string to correlate QueueMarkerEvent calls with MarkerEvent events. In this way, the client is able to distinguish events it caused and events it did not cause.


Paste this example code into the ThisDocument object and then run the UseMarker procedure. The output will be displayed in the Microsoft Visual Basic for Applications (VBA) Immediate window.

Dim WithEvents vsoApplication As Visio.Application 

Private Sub vsoApplication_MarkerEvent(ByVal app As Visio.IVApplication, _ 
 ByVal SequenceNum As Long, ByVal ContextString As String) 

 Debug.Print "Marker: " &; app.EventInfo(0) 

End Sub 

Private Sub vsoApplication_ShapeAdded(ByVal Shape As Visio.IVShape) 

 Debug.Print " ShapeAdded: " &; Shape.Name 

End Sub 

Public Sub UseMarker() 

 Set vsoApplication = ThisDocument.Application 

 'Marker events can be used to comment a segment 
 'of events in the queue. 
 vsoApplication.QueueMarkerEvent "I am starting..." 
 ActivePage.DrawRectangle 0, 0, 3, 3 
 vsoApplication.QueueMarkerEvent "I am finished..." 

End Sub

The output in the VBA Immediate window looks like this:

Marker: I am starting...

ShapeAdded: Sheet.1

Marker: I am finished...

© 2018 Microsoft