VBA & Macro Problems

How to Remove Multiple Rich Text Content Controls in Word Using VBA

Adam DavisAdam Davis Oct 26, 2026 870 views

Question details

The user needs to bulk remove or modify the appearance and locking settings of multiple Rich Text Content Controls within a Word template.

How to Remove Multiple Rich Text Content Controls in Word Using VBA
Product
Word
Device & OS
not provided
Scenario
Editing a Word template filled with multiple content controls that need to be cleared, unlocked, or hidden simultaneously.
Observed behavior
The user is seeking an automated macro method to handle the content controls in bulk, and mentions that running previous macros resulted in errors.
Before you start

Always save a backup copy of your Word template before running any VBA macros, as macro executions typically cannot be reversed using the standard Undo feature.

Solution 1Recommended

Use a VBA Macro to Unlock and Delete Rich Text Content Controls

Run a specific VBA script to automatically find, unlock, and delete all rich text content controls in the active Word document.

This method iterates through all content controls in your document. It specifically targets the rich text type, removes any locking restrictions on the control itself, and then deletes the control.

1
Open the VBA Editor

Press 'Alt + F11' on your keyboard to open the Visual Basic for Applications (VBA) editor in Word. Click 'Insert' from the top menu and select 'Module' to create a new standard module.

2
Paste the VBA Code

Copy and paste the following code into the new module window: Dim CCtrl As ContentControl For Each CCtrl In ActiveDocument.ContentControls If CCtrl.Type = wdContentControlRichText Then CCtrl.LockContentControl = False CCtrl.Delete End If Next CCtrl

3
Run the Macro

Press 'F5' or click the green 'Run' button in the toolbar to execute the macro. All rich text content controls in the document will be unlocked and removed.

Use a VBA Macro to Unlock and Delete Rich Text Content Controls
Troubleshooting Macro Errors: If the macro produces an error, confirm that the code is stored in a standard module, the document is fully editable, and the content controls are not protected by broader document-level restrictions.

Easily Manage Word Templates and Macros with WPS Writer

WPS Office provides excellent compatibility with Microsoft Word documents and offers built-in macro support to help you automate repetitive tasks like modifying or removing content controls.

  1. 1. Open Your Document: Launch WPS Writer and open your .docx or .docm template containing the content controls.
  2. 2. Access Developer Tools: Navigate to the 'Developer' tab on the top ribbon. If it is not visible, enable it from the settings.
  3. 3. Open the Macro Manager: Click on 'Macros' to open the macro management window, or click 'Visual Basic' to jump straight into the VBA Editor.
  4. 4. Run the VBA Script: Create a new module, paste your content control removal code, and click 'Run' to execute it seamlessly.
Fully compatible with Microsoft Word .doc, .docx, and .docm formatsBuilt-in VBA editor for creating, debugging, and running custom macrosLightweight, fast, and features an intuitive tabbed interfaceComprehensive developer tools for managing complex forms and templates
QA img-9

Frequently Asked Questions

Why does my macro produce an error when trying to delete the content controls?

This usually happens if the document has restricted editing enabled, if the content controls are strictly protected, or if the VBA code is not placed in a standard module. Check the 'Developer' tab to 'Stop Protection' before running the macro.

Will deleting the rich text content control delete the text inside it?

Using the '.Delete' method on a ContentControl object in VBA removes the control boundaries but typically leaves the text contents intact in the document. If you want to delete the text as well, you would need to clear the control's '.Range' before deleting it.

Can I modify this macro to target plain text content controls?

Yes. You can change the 'wdContentControlRichText' condition in the VBA script to 'wdContentControlText' to specifically target plain text content controls instead.

How do I enable the Developer tab to run this macro?

Go to File > Options > Customize Ribbon, and check the box next to 'Developer' in the right-hand column. This will make the Developer tab visible, giving you access to the Visual Basic editor.