Selection.InsertCells method (Word)
Adds cells to an existing table.
Syntax
expression. InsertCells
( _ShiftCells_
)
expression Required. A variable that represents a Selection object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
ShiftCells | Optional | WdInsertCells | Specifies how to insert the cells into the existing columns and rows of the table. |
Remarks
The number of cells inserted is equal to the number of cells in the selection. You can also insert cells by using the Add method of the Cells object.
Example
This example inserts new cells to the left of the selected cells, and then it surrounds the selected cells with a red, single-line border.
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
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.