Fix a Word Template ActiveX Button That Works Only Once
Question details
Determine why an ActiveX command button stops responding after its first click in a document created from a Word template.

- 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.
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.
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.
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.
Click in the margin beside an executable line near the start of the button's Click procedure, or select the line and press F9.
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.
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.
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.

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.

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.




