WD2000: How to Create a Macro That Adds a Command Button with Code to a Document (211776)
The information in this article applies to:
This article was previously published under Q211776 SUMMARY
The following Microsoft Visual Basic for Applications sample code allows for user intervention between macros.
This sample code runs in the following sequence:
- The macro adds a command button to an open Microsoft Word document.
- The macro adds code from a text file to the current project.
NOTE: In this example, the code that is copied to the document project is the Click event for the command button. - When the command button is clicked, another macro is run.
- The button and code are removed from the document.
REFERENCESFor additional information, click the article numbers below
to view the articles in the Microsoft Knowledge Base:
212623 WD2000: Macro Programming Resources
226118 OFF2000: Programming Resources for Visual Basic for Applications
Modification Type: | Major | Last Reviewed: | 8/30/2002 |
---|
Keywords: | kbhowto kbinfo KB211776 |
---|
|