Is there any method or macro to remove all content controls in MS Word?

Viewed 34906

I need to remove all content controllers (Loked and unlocked) in active document without removing any text. I've search and found a macro for this. But I think it's not work properly.

Word VBA to delete Content Controls with specific Tags

Is it possible to do this?

Edited: I've tried below code. It'll remove content controllers with text content. I need to remove only content controllers.

Sub Test()
Dim objCC As ContentControl
Do While ActiveDocument.ContentControls.Count > 0
For Each objCC In ActiveDocument.ContentControls
objCC.Delete True
Next
Loop
End Sub
3 Answers

I was able to remove all content controls (in Word 2013) without any macros as follows:

  1. On the developer menu, select Design Mode.
  2. If no content controls are visible, scroll through until one is.
  3. Press Ctrl+A to select the entire document.
  4. Right-click a visible content control.
  5. In the context menu, click Remove Content Control.

I don't know if it works for all types of Content Controls.

Thanks for this answer--it was just what I was looking for. I ended up using the following:

Sub ContentControlRemoval()
'
'Remove all content controls
Set oRng = ActiveDocument.Content
LTCC = LTCC + oRng.ContentControls.Count
For LC = oRng.ContentControls.Count To 1 Step -1

Set CC = oRng.ContentControls(LC)
If CC.LockContentControl = True Then
    CC.LockContentControl = False
End If
CC.Delete
If Not LE Then
    LRCC = LRCC + 1
    End If
    LE = False
Next
End Sub
Related