InsertCells 方法

       

向原有表格添加单元格。插入的单元格数量等于选定内容中包含的单元格数量。

注意   用 Cells 对象的 Add 方法也可插入单元格。

expression.InsertCells(ShiftCells)

expression   必需。该表达式返回一个 Selection 对象。

ShiftCells   可选。 WdInsertCells

示例

本示例在所选单元格的左侧插入新单元格,然后为选定的单元格添加红色的单线边框。

If Selection.Cells.Count >= 1 Then
    Selection.InsertCells ShiftCells:=wdInsertCellsShiftRight
    For Each aBorder In Selection.Borders
        aBorder.LineStyle = wdLineStyleSingle
        aBorder.ColorIndex = wdRed
    Next aBorder
End If