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
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.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for