ShapeRange.Distribute Method
Publisher Developer Reference |
Evenly distributes the shapes in the specified shape range.
Syntax
expression.Distribute(DistributeCmd, RelativeTo)
expression A variable that represents a ShapeRange object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
DistributeCmd | Required | MsoDistributeCmd | Specifies whether shapes are to be distributed horizontally or vertically. |
RelativeTo | Required | MsoTriState | Specifies whether to distribute the shapes evenly over the entire horizontal or vertical space on the page or within the horizontal or vertical space that the range of shapes originally occupies. |
Remarks
Shapes are distributed so that there is an equal amount of space between one shape and the next. If the shapes are so large that they overlap when distributed over the available space, they are distributed so that there is an equal amount of overlap between one shape and the next.
The DistributeCmd parameter can be one of the following MsoDistributeCmd constants declared in the Microsoft Office type library.
msoDistributeHorizontally |
msoDistributeVertically |
The RelativeTo parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.
Constant | Description |
---|---|
msoFalse | Distribute the shapes within the horizontal or vertical space that the range of shapes originally occupies. |
msoTrue | Distribute the shapes evenly over the entire horizontal or vertical space on the page. |
When RelativeTo is msoTrue, shapes are distributed so that the distance between the two outer shapes and the edges of the page is the same as the distance between one shape and the next. If the shapes must overlap, the two outer shapes are moved to the edges of the page.
When RelativeTo is msoFalse, the two outer shapes are not moved; only the positions of the inner shapes are adjusted.
The z-order of shapes is unaffected by this method.
Example
This example defines a shape range that contains all the AutoShapes on the first page of the active publication and then horizontally distributes the shapes in this range.
Visual Basic for Applications |
---|
|
See Also