Event.SetFilterObjects method (Visio)

Specifies an array of object types and a True or False value indicating how to filter events for each object.

Syntax

expression. SetFilterObjects( _Objects()_ )

expression A variable that represents an Event object.

Parameters

Name Required/Optional Data type Description
Objects() Required Long An array of objects types and a True or False value specifying how to filter events for each object type.

Return value

Nothing

Remarks

When an Event object created with the AddAdvise method is added to the EventList collection of a source object, the default behavior is that all occurrences of that event are passed to the event sink. The SetFilterObjects method provides a way to ignore selected events based on object type.

The Objects() parameter passed to SetFilterObjects is an array defined in the following manner.

The number of elements in the array is a multiple of 2:

  • The first element contains an object type (one of visTypePage, visTypeGroup, visTypeShape, visTypeForeignObject, visTypeGuide, or visTypeDoc).

  • The second element contains a True or False value indicating whether you are listening to events for that object (True to listen to an object's events; False to exclude an object's events).

For an event to successfully pass through an object event filter, it must satisfy the following criteria:

  • It must be a valid object type.

  • If all filters are True, the event must match at least one filter.

  • If all filters are False, the event must not match any filter.

  • If the filters are a mixture of True and False, the event must match at least one True filter and not match any False filters.

If there are no True ranges defined in the array, events are considered True.

For example, if you want to listen only to events sourced by a shape or guide, you can pass an array like the following:

 
 Dim aFilterObjects(1 To (2 * 2)) As Long 
 aFilterObjects(1) = visTypeShape 
 aFilterObjects(2) = True 
 aFilterObjects(3) = visTypeGuide 
 aFilterObjects(4) = True 

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.