title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
Rows.Add method (Word) |
vbawd10.chm155975780 |
|
|
d84286cb-42b5-a717-f152-0d9c3f1c6d9c |
06/08/2017 |
medium |
Returns a Row object that represents a row added to a table.
expression.Add ( _BeforeRow_
)
expression Required. A variable that represents a Rows object.
Name | Required/Optional | Data type | Description |
---|---|---|---|
BeforeRow | Optional | Variant | A Row object that represents the row that will appear immediately below the new row. |
Row
This example inserts a new row before the first row in the selection.
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.
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.Add(BeforeRow:=tblNew.Rows(1))
For Each celTable In rowNew.Cells
celTable.Range.InsertAfter Text:="Cell " & intCount
intCount = intCount + 1
Next celTable
End Sub
[!includeSupport and feedback]