Home Word template: command button runs wrong macro
Reply: 0

Word template: command button runs wrong macro

user1676 Published in March 18, 2018, 1:46 am

(Office 365 ProPlus version 1701 build 7766.2099, running on Windows 7)

(Edited post, original is lower.) ActiveX command buttons that occur in a template in a different order than they were created can call the wrong macro, when a file is created from that template.

Exact steps to reproduce: Create a new document. Save it as a .dotm file. Press enter a couple times to create space at the top of the document. Create an ActiveX Command Button. Double-click it to create procedure, put in MsgBox to ID it. Create a second button ABOVE the first, and its procedure. Now, when the buttons are clicked in the template, they work fine (top one reports 2, bottom reports 1), but when clicked in a file created from the template (double-click file in Explorer window), they are swapped (top reports 1, bottom reports 2).

(Original) A very long time ago (earlier version of Word), I created a Word template (.dotm) with buttons that run macros. It used to work fine. I've recently discovered that the buttons now call the wrong macros. If I double-click the template file (creating a new file based on the template), the first button calls the third button's macro and vice-versa. (Middle button, "Fill out forms", works fine.) If I right-click the template and choose Open (open the template itself, not create a new file), the buttons work as designed.

I've boiled the template down to just the 3 buttons and their macros (see photos), and am still seeing the same issue. Clicking "Reset fields", which should call ResetFieldsButton_Click(), instead runs MyPrintButton_Click(). (I get the "Printing..." popup.) What's going on?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302978 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO