Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ShapeRange.Align Method

Office 2007
Aligns all the shapes in the specified ShapeRange object.

Syntax

expression.Align(AlignCmd, RelativeTo)

expression   A variable that represents a ShapeRange object.

Parameters

NameRequired/OptionalData TypeDescription
AlignCmdRequiredMsoAlignCmdSpecifies how the shapes are to be aligned.
RelativeToRequiredMsoTriStateSpecifies whether shapes are aligned relative to the page or to one another.

Remarks

If the RelativeTo parameter is msoFalse and the shape range contains only one shape, an error occurs.

The AlignCmd parameter can be one of the MsoAlignCmd constants declared in the Microsoft Office type library.

ConstantDescription
msoAlignBottomsAligns shapes along their bottom edges. If RelativeTo is msoFalse, the bottommost shape determines the line against which the other shapes are aligned.
msoAlignCentersAligns shapes on a vertical line through their centers. If RelativeTo is msoFalse, shapes are aligned on a line halfway between the left- and rightmost shapes.
msoAlignLeftsAligns shapes along their left edges. If RelativeTo is msoFalse, the leftmost shape determines the line against which the other shapes are aligned.
msoAlignMiddlesAligns shapes on a horizontal line through their centers. If RelativeTo is msoFalse, shapes are aligned on a line halfway between the top- and bottommost shapes.
msoAlignRightsmsoAlignRights Aligns shapes along their right edges. If RelativeTo is msoFalse, the rightmost shape determines the line against which the other shapes are aligned.
msoAlignTops Aligns shapes along their top edges. If RelativeTo is msoFalse, the topmost shape determines the line against which the other shapes are aligned.

The RelativeTo parameter can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

ConstantDescription
msoFalseAligns shapes relative to one another.
msoTrueAligns shapes relative to the page.

Example

The following example aligns all the shapes on the first page of the active publication on a vertical line through their centers.

Visual Basic for Applications
ActiveDocument.Pages(1).Shapes.Range.Align _
    AlignCmd:=msoAlignCenters, _
    RelativeTo:=msoTrue



Community Additions

Show: