Shape.CreateSelection Method (Visio)
Creates various types of Selection objects.
expression .CreateSelection(SelType, IterationMode, [Data])
expression A variable that represents a Shape object.
The type of selection. See Remarks for possible values.
The selection mode used. See Remarks for possible values.
The object type that corresponds to the SelType argument. See Remarks for possible values.
The CreateSelection method makes it possible to create complex selections programmatically. So instead of having to select all shapes on a page, for example, you can select only those on a given layer, or only those based on a certain master.
Calling the CreateSelection method with SelType equal to visSelTypeByType or visSelTypeByLayer is equivalent to selecting options in the Select byType dialog box (click Select in the Editing group on the Home tab, and then click Select by Type).
The SelType argument should be one of the following values, which are declared in VisSelectionTypes in the Visio type library.
A selection that initially contains all shapes.
A selection that initially contains all shapes that have a given type of data graphic appled.
A selection that initially contains all the shapes of a given layer.
A selection that initially contains all the instantiated shapes of a given master.
A selection that initially contains all the shapes of a given role.
A selection that initially contains all the shapes of a given type.
A selection that initially contains no shapes.
A selection that initially contains one shape.
The optional IterationMode argument should be one of the following values, which are declared in VisSelectMode in the Visio type library. The default is visSelModeSkipSuper.
Selection only reports subselected shapes.
Selection only reports superselected shapes.
Selection does not report subselected shapes.
Selection does not report superselected shapes.
The optional Data argument should be an object that corresponds to the object type specified by SelType. For example, if you want to select all the masters of a certain type, Data should be of type Master. And if you want to select all the shapes on a certain layer, Data should be of type Layer.
When SelType is visSelTypeByRole, Data should be a member of the VisRoleSelectionTypes enumeration.
When the SelType argument is visSelTypeByType, possible Data values should be one of the following values, which are declared in VisTypeSelectionTypes in the Visio type library.
A shape that is a bitmap.
A shape that contains other shapes.
A shape that is a guide.
A shape that is ink.
A shape that is a metafile.
A shape that is linked, embedded, or a control.
A native Visio shape.