PDA

View Full Version : Command Buttons



jrooney7
09-21-2021, 06:36 AM
Hello all,

I have created a dotm with several tables that are inserted via macro. The tables are saved as QuickParts and each has a command button. Periodically when testing the document by opening a docm and inserting a table, the command button is gone and is replaced with the following text: "Error! Objects cannot be created from editing field codes." I created the command buttons from the developer tab, using the ActiveX command buttons, so I don't know what to make of this error message and how to stop this from happening?

Thank you!

gmayor
09-21-2021, 08:40 PM
If you create a new document from a template the code remains in the template and can only be used as long as the document has access to the template.
Frankly I wouldn't use Active X command buttons. They are a throwback to Word's ability to create html documents, It would be better to create a ribbon tab for your template - http://gregmaxey.mvps.org/word_tip_pages/customize_ribbon_main.html or you could add a userform to your template and use that to select which tables are added to the document.

Chas Kenyon
09-22-2021, 08:01 PM
Personally, I would prefer to assign the macros to QAT buttons instead of Command Butons. It is much simpler.
Modifying the Quick Access Toolbar (QAT) in Microsoft Word
(http://addbalance.com/word/QATmodification.htm)This would still require that the document remain attached to the template containing the macros and QAT modifications. (A custom ribbon tab is more elegant but also more work.) If you want to use a UserForm, you may want to look at Graham's page: Create a Simple Userform (http://www.gmayor.com/Userform.htm).