Lines Collection

Microsoft Word Visual Basic

Lines Collection

Rectangle Lines
Line
Multiple objects

A collection of Line objects that represents the lines in a Rectangle object that is of type wdTextRectangle.

Using the Lines Collection

Use the Lines property to return a collection of lines for a specified rectangle. The following example accesses the lines in the first rectangle in the first page in the active document.

    Dim objLines As Lines

Set objLines = ActiveDocument.ActiveWindow.Panes(1) _
    .Pages(1).Rectangles(1).Lines
  

Use the RectangleType property of the specified Rectangle object to determine whether the Rectangle object is of type wdTextRectangle. The following example returns the collection of lines in the first rectangle in the first page of the active document if the specified rectangle contains text.

    Dim objRectangle As Rectangle
Dim objLines As Lines

Set objRectangle = ActiveDocument.ActiveWindow _
    .Panes(1).Pages(1).Rectangles(1)

If objRectangle.RectangleType = wdTextRectangle Then _
    Set objLines = objRectangle.Lines