This documentation is archived and is not being maintained.

DrawRegion method

DrawRegion method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

See also         Example Applies to

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

Version added



objRet = object.DrawRegion(tolerance, flags, [x], [y], [ResultsMaster])


A Shape object.


Required. An expression that returns a Selection object.


Required Double. Error 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.


Required Integer. A constant or integer that specifies how to draw the region.


Optional Variant. X-coordinate in internal units in the coordinate space of the Selection object.


Optional Variant. Y-coordinate in internal units in the coordinate space of the Selection object.


Optional Variant. The Master object which the new Shape object should be an instance of.


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 using the Fragment operation.
  • If no closed region is defined by the selected shapes, then 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.






Delete items in selection.



Include hidden geometry.



Exclude visible 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) , then 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.