Skip to content

Latest commit

 

History

History
80 lines (50 loc) · 1.5 KB

Word.Rows.Add.md

File metadata and controls

80 lines (50 loc) · 1.5 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Rows.Add method (Word)
vbawd10.chm155975780
vbawd10.chm155975780
Word.Rows.Add
d84286cb-42b5-a717-f152-0d9c3f1c6d9c
06/08/2017
medium

Rows.Add method (Word)

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

Syntax

expression.Add ( _BeforeRow_ )

expression Required. A variable that represents a Rows object.

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.

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

See also

Rows Collection Object

[!includeSupport and feedback]