Document Editing Problems

Fix a Word Template ActiveX Button That Works Only Once

Olivia MillerOlivia Miller Nov 14, 2026 869 views

Question details

Determine why an ActiveX command button stops responding after its first click in a document created from a Word template.

Fix a Word Template ActiveX Button That Works Only Once
Product
Microsoft Word
Device & OS
not provided
Scenario
A user creates a document from a macro-enabled template and clicks a button that inserts a page.
Observed behavior
The button works when the template is opened directly, but in the new document it works only on the first click. Its code remains visible in the VBA editor and can be run manually.
Before you start

Create a new document from the affected template and reproduce the first successful click. Use desktop Word with ActiveX and macros enabled for this trusted file, and make sure the Developer tab is available.

Solution 1Recommended

Debug the button event in the generated Word document

Use a breakpoint to determine whether later clicks reach the button procedure, then inspect the values and references used by the code.

1
Open the VBA editor

In the document created from the template, select Developer > Visual Basic. In Project Explorer, locate the button's event procedure in the relevant document or template project.

2
Set a breakpoint

Click in the margin beside an executable line near the start of the button's Click procedure, or select the line and press F9.

3
Test repeated clicks

Return to the document, ensure Developer > Design Mode is off, and click the button. Continue execution with F5 if it pauses, then click the button again and check whether the breakpoint is reached.

4
Inspect the code and values

If execution reaches the breakpoint, use Debug > Step Into or press F8 to follow the procedure. Check that the page-count variable is declared and has the expected value, and that any file path used by the code points to an existing file.

5
Check the event connection

If later clicks do not reach the breakpoint, turn on Developer > Design Mode, inspect the button's name in Properties, and use View Code to check that the Click procedure corresponds to that control in the generated document.

Debug the button event in the generated Word document
Test the document, not just the template: Code that runs manually or works when the template is opened directly does not establish that later button clicks in the generated document are reaching the same event procedure.
Free Microsoft Office alternative

Edit Word Documents with WPS Writer

WPS Office is a free, lightweight alternative with a familiar interface for opening and editing Word documents, making everyday document migration straightforward. Diagnosing a Microsoft Word ActiveX event still requires Word and its VBA editor.

Edit documents in a familiar word-processing interfaceOpen and save Microsoft Word DOC and DOCX filesCreate and edit documents with a free, lightweight office suiteWork with document content without relying on an ActiveX button
microsoft office alternative - wps office

Frequently Asked Questions

Why does the button code run manually but not on a second click?

Running a procedure manually does not confirm that the control's Click event is connected to it. Set a breakpoint near the start of the procedure in Developer > Visual Basic, then click the button again to see whether the event reaches it.

What should I check if the breakpoint is reached?

Use F8 in the VBA editor to step through the procedure. Check the page-count variable's declaration and value, and verify that any file path referenced by the code is valid.

Why won't the button respond while I am testing it?

Check that Developer > Design Mode is off and that macros and ActiveX are enabled for the trusted file. Then try the button again in the document created from the template.

Can WPS Office repair the Word ActiveX event?

WPS Office can edit Word documents, but it does not repair a Microsoft Word ActiveX event. Use Word's Developer > Visual Basic tools to diagnose the button and test any changes.