ContentControl.Delete method (Word)

Deletes the specified content control and the contents of the content control.

Syntax

expression.Delete( _DeleteContents_ )

expression An expression that returns a ContentControl object.

Parameters

Name Required/Optional Data type Description
DeleteContents Optional Boolean Specifies whether to delete the contents of the content control. True removes both the content control and its contents. False removes the control but leaves the contents of the content control in the active document. The default value is False.

Example

The following example removes all content controls and their contents from the active document.

Dim objCC As ContentControl 
 
Do While ActiveDocument.ContentControls.Count > 0 
 For Each objCC In ActiveDocument.ContentControls 
 objCC.Delete True 
 Next 
Loop

See also

ContentControl Object

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.