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

Selection.DrawRegion Method (Visio)

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

Draws a new shape that represents the region containing a given point.


expression . DrawRegion( Tolerance , Flags , x , y , ResultsMaster )

expression A variable that represents a Selection object.


NameRequired/OptionalData TypeDescription
ToleranceRequiredDoubleError tolerance when determining the coincidence of points. A distance expressed in internal units in the coordinate space of the Selection object's containing shape; the maximum gap between paths that is tolerated when constructing the boundaries of a region.
FlagsRequiredIntegerA constant or integer that specifies how to draw the region.
xOptionalVariantx-coordinate in internal units in the coordinate space of the Selection object.
yOptionalVarianty-coordinate in internal units in the coordinate space of the Selection object.
ResultsMasterOptionalVariantThe Master object which the new Shape object should be an instance of.

Return Value



The DrawRegion method creates a new Shape object from pieces of the paths in the Selection object.

  • If both x and y are specified, the resulting shape is the smallest region that contains the point ( x, y).

  • In the absence of either x or y, or if the point ( x, y) is not contained in any region enclosed by the paths of the selected shapes, the result is the union of all the shapes that would have been created by using the Fragment operation.

  • If no closed region is defined by the selected shapes, the DrawRegion method returns Nothing and raises no exception.

The Flags argument can be one or a combination of the following constants declared by the Visio type library in VisDrawRegionFlags .

**Name ****Value ****Description **
visDrawRegionDeleteInput&;H4Delete items in selection.
visDrawRegionIgnoreVisible&;H20Exclude visible geometry.
visDrawRegionIncludeDataGraphics&;H40Include data graphic callout shapes and their sub-shapes.
visDrawRegionIncludeHidden&;H10Include hidden geometry.

If the DrawRegion method is passed a ResultsMaster of type VT_EMPTY or VT_ERROR (which is how VBA passes an unspecified optional argument), the new shape is not an instance of a master and the fill, line, and text styles of the new region are set to the document's default styles.

If the DrawRegion method is passed a reference to a Master object in ResultsMaster (type VT_UNKNOWN or VT_DISPATCH), the DrawRegion method instances that Master object and adds geometry computed given the Selection object.

The new Shape object has no text other than text already in ResultsMaster.

© 2018 Microsoft