Microsoft Office 2000/Visual Basic Programmer's Guide   

Microsoft Word Command Bars

When you create a command bar in Word, you have the option of storing that command bar in the Normal.dot template, in a separate template, or in the currently active document. If the command bar is stored with the Normal.dot template, it will be available to any document, even if the document is based on a different template. If the command bar is stored with the currently active document and that document is a template, the command bar will be available for any document created based on that template. If the command bar is stored with a document, it will be available only when that document is open.

In Word, custom command bars are stored in the Normal.dot file by default. If user profiles have been set up for multiple users, this file is stored in the C:\Windows\Profiles\UserName\Application Data\Microsoft\Templates subfolder. If user profiles have not been set up, the Normal.dot file is stored in the C:\Windows\Application Data\Microsoft\Templates subfolder. Command bars created in other documents or in document templates are stored with that document or template.

When you create custom solutions based on Word, it is typical to store your code in a custom document template so that the code is available to documents created based on your template. You should also store any custom command bars in the template on which your custom solution documents are based. If you need to have your command bars available to documents based on more than one template, you can store them in a global template or add-in. For more information about templates and add-ins, see Chapter 11, "Add-ins, Templates, Wizards, and Libraries."

Note   It is not a good practice to store your code or command bars in a user's Normal.dot file. Many users or system administrators protect the Normal.dot file from modifications in order to prevent the file from being infected by a virus or to keep the file from growing to an unreasonable size. Since you can never be sure that Normal.dot will be available for modifications, you should use your own custom template or add-in to distribute your code.

When you create custom command bars in Word by using the Customize dialog box, you specify where the command bar is stored by using the Save In box on the Commands tab of the Customize dialog box. When you create a custom command bar in Word by using VBA code, you specify where it is stored by using the CustomizationContext property of the Application object.