Rows.Add Method

Word Developer Reference

Returns a Row object that represents a row added to a table.

Syntax

expression.Add(BeforeRow)

expression   Required. A variable that represents a Rows collection.

Parameters

Name Required/Optional Data Type Description
BeforeRow Optional Variant A Row object that represents the row that will appear immediately below the new row.

Return Value
Row

Example

This example inserts a new row before the first row in the selection.

Visual Basic for Applications
  Sub AddARow()
    If Selection.Information(wdWithInTable) = True Then
        Selection.Rows.Add BeforeRow:=Selection.Rows(1)
    End If
End Sub

This example adds a row to the first table and then inserts the text Cell into this row.

Visual Basic for Applications
  Sub CountCells()
    Dim tblNew As Table
    Dim rowNew As Row
    Dim celTable As Cell
    Dim intCount As Integer
intCount = 1
Set tblNew = ActiveDocument.Tables(1)
Set rowNew = tblNew.Rows.<strong class="bterm">Add</strong>(BeforeRow:=tblNew.Rows(1))
For Each celTable In rowNew.Cells
    celTable.Range.InsertAfter Text:="Cell " &amp; intCount
    intCount = intCount + 1
Next celTable

End Sub

See Also