Skip to content

Latest commit

 

History

History
72 lines (48 loc) · 1.96 KB

Word.ShapeRange.Distribute.md

File metadata and controls

72 lines (48 loc) · 1.96 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
ShapeRange.Distribute method (Word)
vbawd10.chm162856973
vbawd10.chm162856973
Word.ShapeRange.Distribute
fae7b87a-9542-7018-15fb-a4e4efee4c9b
06/08/2017
medium

ShapeRange.Distribute method (Word)

Evenly distributes the shapes in the specified range of shapes. .

Syntax

expression. Distribute( _Distribute_ , _RelativeTo_ )

expression Required. A variable that represents a ShapeRange object.

Parameters

Name Required/Optional Data type Description
Distribute Required MsoDistributeCmd Specifies whether to distribute shapes horizontally or vertically.
RelativeTo Required Long True to distribute the shapes evenly over the entire horizontal or vertical space on the page. False to distribute them within the horizontal or vertical space that the range of shapes originally occupies.

Remarks

You can specify whether you want to distribute the shapes horizontally or vertically and whether you want to distribute them over the entire page or just over the space they originally occupy.

Example

This example defines a shape range that contains all the AutoShapes on the active document and then horizontally distributes the shapes in this range.

With ActiveDocument.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

See also

ShapeRange Collection Object

[!includeSupport and feedback]