共用方式為


PowerPoint) (ShapeRange.Distribute 方法

在指定的圖案範圍內平均分配圖案。 可以指定要水平還是垂直分配圖案,以及要在整個投影片中分配圖案,還是只在圖案原先佔用的空間中進行分配。

語法

expression. Distribute( _DistributeCmd_, _RelativeTo_ )

表達 代表 ShapeRange 物件的 變數。

參數

名稱 必要/選用 資料類型 描述
DistributeCmd 必要 MsoDistributeCmd 指定要水平還是垂直分配範圍中的圖案。
RelativeTo 必要 MsoTriState 決定要在投影片的整個水平空間還是垂直空間中平均分配圖案。

傳回值

範例

本範例定義包含 myDocument 上的所有自動圖案的圖案範圍,然後水平分配這個範圍中的圖案。

Set myDocument = ActivePresentation.Slides(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, msoFalse 
        End If 
    End If 
End With

另請參閱

ShapeRange 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應