水平或垂直地分布指定的图形子集中的各图形。
expression.Distribute(DistributeCmd, RelativeTo)
expression 必需。该表达式返回“应用于”列表中的对象之一。
DistributeCmd MsoDistributeCmd 类型,必需。指定图形子集中的图形是在水平方向进行分布,还是在垂直方向进行分布。
| MsoDistributeCmd 可为以下 MsoDistributeCmd 常量之一。 | 
| msoDistributeHorizontally | 
| msoDistributeVertically | 
RelativeTo MsoTriState 类型,必需。不能用于 Microsoft Excel 中。必须为 False。
| MsoTriState 可为以下 MsoTriState 常量之一。 | 
| msoCTrue | 
| msoFalse | 
| msoTriStateMixed | 
| msoTriStateToggle | 
| msoTrue | 
本示例在 myDocument 上定义了一个包含所有自选图形对象的图形子集,然后水平地分布该子集中的图形。最左边的图形将保留在原位。
Set myDocument = Worksheets(1)
With myDocument.Shapes
    numShapes = .Count
    If numShapes > 1 Then
        numAutoShapes = 0
        ReDim autoShpArray(1 To numShapes)
        For i = 1 To numShapes
            If .Item(i).Type = msoAutoShape Then
                numAutoShapes = numAutoShapes + 1
                autoShpArray(numAutoShapes) = .Item(i).Name
            End If
        Next
        If numAutoShapes > 1 Then
            ReDim Preserve autoShpArray(1 To numAutoShapes)
            Set asRange = .Range(autoShpArray)
            asRange.Distribute msoDistributeHorizontally, False
        End If
    End If
End With