Delete Method

See Also         Example         Applies To

Syntax 1: Deletes the specified object.

Syntax 2: Deletes a table cell or cells and optionally controls how the remaining cells are shifted.

Syntax 3: Deletes the specified number of characters or words. This method returns a value that indicates the number of items deleted, or it returns 0 (zero) if the deletion was unsuccessful.

Syntax 1

expression.Delete

Syntax 2

expression.Delete(ShiftCells)

Syntax 3

expression.Delete(Unit, Count)

expression   Syntax 1: Required. An expression that returns an object in the Applies To list.

Syntax 2: Required. An expression that returns a Cell or Cells object.

Syntax 3: Required. An expression that returns a Range or Selection object.

ShiftCells   Optional Variant. The direction in which the remaining cells are to be shifted. Can be one of the following WdDeleteCells constants: wdDeleteCellsEntireColumn, wdDeleteCellsEntireRow, wdDeleteCellsShiftLeft, or wdDeleteCellsShiftUp.

Unit   Optional Variant. The unit by which the collapsed range or selection is to be deleted. Can be either of the following WdUnits constants: wdCharacter or wdWord. The default value is wdCharacter.

Count   Optional Variant. The number of units to be deleted. To delete units after the range or selection, collapse the range or selection and use a positive number. To delete units before the range or selection, collapse the range or selection and use a negative number.