在Microsoft Word 2010中,我有以下宏在我的表单中运行良好。在添加新行之后,我需要它将具有预定义文本的新行添加到第1,2和3列。在第2列中,我需要在同一行内有多行。该表只有3列。我该怎么做?
Sub addrow()
Dim oTable As Table
Dim oCell As Cell
Dim oPrevRow As Row, oNewRow As Row
Dim iColumn As Long
' Insert new row
Set oTable = ActiveDocument.Tables(3)
Set oPrevRow = oTable.Rows(oTable.Rows.count)
oTable.Rows.Add
Set oNewRow = oTable.Rows(oTable.Rows.count)
End Sub
答案 0 :(得分:3)
Set oNewRow = oTable.Rows(oTable.Rows.count)
oNewRow.Cells(1).Range.Text = "Column 1 Text"
oNewRow.Cells(2).Range.Text = "Column 2 Text"
oNewRow.Cells(3).Range.Text = "Column 3 Text"