Split Method

Microsoft Word Visual Basic

Splits a single table cell into multiple cells.

expression.Split(NumRows, NumColumns)

expression    Required. An expression that returns a Cell object.

NumRows   Optional Variant. The number of rows that the cell or group of cells is to be split into.

NumColumns   Optional Variant. The number of columns that the cell or group of cells is to be split into.

ShowSplit method as it applies to the Cells object.

Splits a range of table cells.

expression.Split(NumRows, NumColumns, MergeBeforeSplit)

expression    Required. An expression that returns a Cells object.

NumRows   Optional Variant. The number of rows that the cell or group of cells is to be split into.

NumColumns   Optional Variant. The number of columns that the cell or group of cells is to be split into.

MergeBeforeSplit   Optional Variant. True to merge the cells with one another before splitting them.

ShowSplit method as it applies to the Subdocument object.

Divides an existing subdocument into two subdocuments at the same level in master document view or outline view. The division is at the beginning of the specified range. If the active document isn't in either master document or outline view, or if the range isn't at the beginning of a paragraph in a subdocument, an error occurs.

expression.Split(Range)

expression    Required. An expression that returns a Subdocument object.

Range   Required Range object. The range that, when the subdocument is split, becomes a separate subdocument.

ShowSplit method as it applies to the Table object.

Inserts an empty paragraph immediately above the specified row in the table, and returns a Table object that contains both the specified row and the rows that follow it.

expression.Split(BeforeRow)

expression    Required. An expression that returns a Table object.

BeforeRow   Required Variant. The row that the table is to be split before. Can be a row number or a Row object.

Example

ShowAs it applies to the Cell object.

This example splits the first cell in the first table into two cells.

ActiveDocument.Tables(1).Cell(1, 1).Split NumColumns:=2
				

ShowAs it applies to the Cells object.

This example merges the selected cells into a single cell and then splits the cell into three cells in the same row.

If Selection.Information(wdWithInTable) = True Then
    Selection.Cells.Split NumRows:=1, NumColumns:=3, _
        MergeBeforeSplit:= True
End If
				

ShowAs it applies to the Subdocument object.

This example splits the selection from an existing subdocument into a separate subdocument.

Selection.Range.Subdocuments(1).Split Range:=Selection.Range
				

ShowAs it applies to the Table object.

This example creates a 5x5 table in the active document and splits it before the third row. Shading is applied to the cells in the resulting table (the new 3x5 table).

Set newDoc = Documents.Add
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _
    NumColumns:=5, NumRows:=5)
myTable.Split(BeforeRow:=myTable.Rows(3)).Shading _
    .Texture = wdTexture10Percent