Selection.Delete Method
Word Developer Reference |
Deletes the specified number of characters or words.
Syntax
expression.Delete(Unit, Count)
expression Required. A variable that represents a Selection object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Unit | Optional | Variant | The unit by which the collapsed selection is to be deleted. Can be one of the WdUnits constants. |
Count | Optional | Variant | The number of units to be deleted. To delete units after the selection, collapse the selection and use a positive number. To delete units before the selection, collapse the selection and use a negative number. |
Return Value
Long
Remarks
This method returns a Long value that indicates the number of items deleted, or it returns 0 (zero) if the deletion was unsuccessful.
Example
This example selects and deletes the contents of the active document.
Visual Basic for Applications |
---|
|
See Also