Share via


Rows Property [Publisher 2003 VBA Language Reference]

Rows property as it applies to the LayoutGuides object.

Sets or returns a Long that represents the number of rows in a layout guide. Read/write.

expression.Rows

expression Required. An expression that returns one of the above objects.

Rows property as it applies to the Table object.

Returns a Rows collection that represents all the table rows in a range, selection, or table.

expression.Rows

expression Required. An expression that returns one of the above objects.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection .

Example

As it applies to the LayoutGuides object.

This example sets the columns and rows for the layout guides.

Sub SetLayoutGuides()
    With ActiveDocument.LayoutGuides
        .Columns
        .Rows
    End With
End Sub

As it applies to the Table object.

This example enters the fill for all even-numbered rows and clears the fill for all odd-numbered rows in the specified table. This example assumes the specified shape is a table and not another type of shape.

Sub FillCellsByRow()
    Dim shpTable As Shape
    Dim rowTable As Row
    Dim celTable As Cell

    Set shpTable = ActiveDocument.Pages(1).Shapes _
        .AddTable(NumRows:=5, NumColumns:=5, Left:=100, _
        Top:=100, Width:=100, Height:=12)
    For Each rowTable In shpTable.Table.Rows
        For Each celTable In rowTable.Cells
            If celTable.Row Mod 2 = 0 Then
                celTable.Fill.ForeColor.RGB = RGB _
                    (Red:=180, Green:=180, Blue:=180)
            Else
                celTable.Fill.ForeColor.RGB = RGB _
                    (Red:=255, Green:=255, Blue:=255)
            End If
        Next celTable
    Next rowTable
End Sub

Applies to | LayoutGuides Object | Table Object