Template Issues

Fix Word Template ActiveX and VBA Code in New Documents

Chanuka GeekiyanageChanuka Geekiyanage Nov 25, 2026 869 views

Question details

The user needs ActiveX controls and VBA code from a Word template to work in documents created from it.

Fix Word Template ActiveX and VBA Code in New Documents
Product
Microsoft Word
Device & OS
not provided
Scenario
A new document is created from a template containing an ActiveX control and code in the template's ThisDocument module.
Observed behavior
The new document is named Document1.docx, its ThisDocument module is empty, and the control and VBA code do not work as expected.
Before you start

Check the template's file extension and confirm that you are creating the document from that template, not opening a separate document. Make sure Word's Developer tab is available so you can inspect the template and its VBA project.

Solution 1Recommended

Check the macro-enabled template and its VBA project

Use this approach to verify that the template can store VBA and remains attached to the new document.

An empty ThisDocument module in the new document does not necessarily mean the template's code is missing. Template code normally remains in the template's VBA project rather than being copied into each new document.

A .docx file cannot store VBA code in its own project. Template-level code and document-level ActiveX control events also have different scopes, so attaching a template alone may not make a copied control's events run.

1
Check the template format

Open the template in Word and choose File > Save As. Check that its file type is Word Macro-Enabled Template (*.dotm); if necessary, save a test copy in that format.

2
Create a test document

Create a new document from the .dotm template, then use Developer > Document Template to check that the intended template is attached.

3
Inspect both VBA projects

Open Developer > Visual Basic and expand the template and new document projects in Project Explorer. Compare their ThisDocument modules and check where the procedures are stored.

4
Review the event scope

In the VBA editor, inspect the event procedures in the template's ThisDocument module. Check whether the code is a template event, such as Document_New, or an event intended for an ActiveX control in the new document; the latter may need document-level code or a different event-handling design.

5
Check security and retest

Recreate a document from the test template and follow any Word security prompts. Review File > Options > Trust Center > Trust Center Settings for applicable macro and ActiveX settings without weakening settings that your organization requires.

Check the macro-enabled template and its VBA project
Check ActiveX availability: ActiveX support and security controls depend on the Word version, platform, and organization policies. If ActiveX is unavailable or blocked, the control may not run even when the VBA code is present.
Free Microsoft Office alternative

Create and Edit Word Documents with WPS Writer

WPS Office is a free, lightweight alternative with a familiar interface for editing and moving everyday Word documents. WPS Writer does not fix Microsoft Word template VBA or ActiveX issues; check any macro-dependent workflow before migrating.

Create and edit document templates for everyday workflowsCompatible with common Microsoft Word formats, including DOC and DOCXFamiliar editing tools make the transition from Word easierFree, lightweight suite for documents, spreadsheets, and presentations
microsoft office alternative - wps office

Frequently Asked Questions

Why is ThisDocument empty in the new Word document?

Code stored in the template's ThisDocument module normally stays in the template project. Open Developer > Visual Basic and inspect the template project as well as the new document project.

Does changing a .docx file to .docm copy the template's VBA code?

No. File > Save As > Word Macro-Enabled Document allows the document to store its own VBA, but it does not automatically copy procedures from the template.

How can I check which template is attached?

In Word, open Developer > Document Template and check the template shown for the current document. The Developer tab may need to be enabled in Word's ribbon settings first.

Why does the ActiveX control still not respond?

Check that Design Mode is off on the Developer tab, that the event code is associated with the correct control and document, and that Word's macro and ActiveX security settings permit the workflow. ActiveX availability also depends on the Word version and platform.