This documentation is archived and is not being maintained.

Rectangle Object (Word)

Represents a portion of text or a graphic in a page. Use the Rectangle object and related methods and properties for programmatically defining page layout in a document.

Use the Item method to return a specific Rectangle object. The following example accesses the first rectangle in the first page of the active document.

Dim objRectangle As Rectangle 
 
Set objRectangle = ActiveDocument.ActiveWindow _ 
 .Panes(1).Pages(1).Rectangles.Item(1)

Use the RectangleType property to determine the type of rectangle. The following example creates a ShapeRange object if the specified rectangle is a shape.

Dim objRectangle As Rectangle 
Dim objShape As ShapeRange 
 
Set objRectangle = ActiveDocument.ActiveWindow _ 
 .Panes(1).Pages(1).Rectangles.Item(1) 
 
If objRectangle.RectangleType = wdShapeRectangle Then 
 Set objShape = objRectangle.Range.ShapeRange 
End If
Show: