Share via


Rectangle Object

Rectangles
Rectangle
Multiple objects

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.

Using the Rectangle Object

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

Properties | Application Property | Creator Property | Height Property | Left Property | Lines Property | Parent Property | Range Property | RectangleType Property | Top Property | Width Property

Parent Objects

Child Objects | Lines Object | Range Object