1

在 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
4

1 回答 1

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"
于 2013-06-24T21:48:14.783 回答