Macros on Menus

In our last newsletter, we talked about putting macros on toolbar buttons, but you may prefer putting them on menus instead. Here's how:

In Word 6 or 95:

1. Click the "Tools" menu.

2. Click "Customize."

3. Click the "Menus" tab.

4. In the "Categories" list, on the left, find and click "Macros."

5. In the "Macros" list, on the right, find and click the macro you want to use.

6. In the "Change What Menu" box, find and click the menu you want to use ("Edit," for example, or "Insert").

7. In the "Position on Menu" box, find and click the menu item below which you want your new menu item to appear. (You can also select "Auto" [which lets Word assign the position], "At Top," and "At Bottom.")

8. In the "Name on Menu" box, type the name of your macro as you want it to appear on the menu. (This won't change the actual name of your macro.)

9. Click the "Add" or "Add Below" button.

10. Click the "Close" button.

In Word 97 or later:

1. Click the "Tools" menu.

2. Click "Customize."

3. Click the "Commands" tab.

4. In the "Categories" list, on the left, find and click "Macros."

5. In the "Commands" list, on the right, find and click the macro you want to use and hold down the mouse button.

6. Drag the gray rectangle to the Word menu you want to use ("Edit," for example, or "Insert"). The menu will expand so you can see its entries.

7. Drag the gray rectangle to the position where you want your menu item to appear.

8. Release the mouse button. Your new menu item will appear on the menu, displaying the name of the macro.

9. In Word 97 or later, click the "Modify Selection" button or right-click the menu item you just added. A menu will appear.

10. Use the menu items to change the appearance of your new menu item until you're happy with it (see the explanations below).

11. When you're finished, click the "Close" button.

Your new menu item will appear on the menu you selected, displaying the name of the macro.

Now you can click the menu item to run your macro.

Here's an explanation of the items on the "Modify Selection" menu:

* "Delete" deletes the selected button.

* "Name" lets you change the text displayed on the menu (without affecting the name of the macro).

* "Copy Button Image" copies the icon from a selected button or menu item.

* "Paste Button Image" pastes a copied icon to the left of a selected menu item.

* "Reset Button Image" resets a menu item to its default appearance, which is blank for a new menu item to which you've assigned an icon.

* "Edit Button Image" lets you create your own icons or modify existing ones. Be careful; it's easy to spend hours playing around in here.

* "Change Button Image" lets you select one of Word's built-in icons. I frequently use the smiley face to run a quick-and-dirty macro for a particular project.

* "Default Style" displays the icon and menu name for a menu item that has both an icon and a text name.

* "Text Only (Always)" displays only the menu item's name, hiding the icon if you've assigned one. (The "Always" means this will be true even if you drag the item to a toolbar button.)

* "Text Only (In Menus)" displays only the menu item's name on the menu (but not if you drag it to a toolbar).

* "Image and Text" displays both the icon and the menu item's name.

* "Begin a Group" separates the menu item from previous menu items with a thin, gray line.

* "Assign Hyperlink" lets you use the menu item to link to a Web page, a file, a picture, or other items, but that's a topic for another day.

When you close Word, the program will ask if you want to save the changes you've made to the Normal (or other) template. In other words, do you want to keep the menu item you've added? If you do, click yes (this will also save any other changes you've made to the template).

_________________________________________

READERS WRITE

Subscriber Brian Vicary wrote:

I have read with great interest your articles concerning Word macros--in particular your more advanced series dealing with creating macros and making them available automatically via add-in templates.

As part of our business I visit our clients' sites to install software and to perform updates when necessary. We supply a Word template with predefined macros to make the use of our software easier. On networks we prefer our template to be shared so that we only have one location to update. While this can be accomplished by pointing the Word Startup path to this shared location, it is often not possible if the users already have templates in their Startup folder. Often users already have slightly different Startup templates for their own use or do not need access to a particular template.

You can add templates using the Tools, Templates and Add-Ins option, but you have to manually activate them each time you run Word.

To get round this problem this is what I do:

1. Open Word and then close the blank document that is open.

2. Go to the Tools menu and select the Macro option; from there select the Record New Macro.... option.

3. Give the macro a name appropriate to the macro--for example, AddMyMacro.

4. Click OK to begin recording the macro.

5. Click the Tools menu and select the Templates and Add-Ins option.

6. Click the Add button.

7. Navigate to where the Template document is stored on the network and select it. It should appear in the Add-ins list with a tick.

8. Click the OK button.

9. Stop recording the macro.

10. Go to the Tools menu and select the Macro option; from there select the Macros.... option.

11. Enter the name AutoExec in the Macro Name box and click the Create button. This will open the Visual Basic Editor with the new macro AutoExec.

12. In the sub for AutoExec, enter the name of the new macro you recorded above--for example, AddMyMacro.

13. Close the Visual Basic Editor.

14. Close and restart Word.

Now when Word starts, it automatically runs the macro AutoExec. This in turn runs the macro name you entered, AddMyMacro, which loads and activates the required template.

If you already have an AutoExec macro, just add a new line to it with the name of your macro. Any number of macros can be added this way, and you also have control over who loads what macros, as well as allowing them to maintain a personal Startup path.

You can also add the template in the usual manner without recording a macro, then record a macro of your activating it. The process is exactly the same, and the result is also exactly the same.

The only drawback can be the speed of the network if your macros are complex, but in practice I have not found this to be a major problem. Also, you have to get everyone to close their Word if you need to update any of the Add-on templates. However, this is true whatever method you use for sharing templates.

Hope this may be of interest to any of your readers.

Thanks very much to Brian for this useful tip.

This entry was posted in Macros. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

You must be logged in to post a comment.

  • The Fine Print

    Thanks for reading Editorium Update (ISSN 1534-1283), published by:

    The EDITORIUM, LLC
    http://www.editorium.com

    Articles © on date of publication by the Editorium. All rights reserved. Editorium Update and Editorium are trademarks of the Editorium.

    You may forward copies of Editorium Update to others (but not charge for it) and print or store it for your personal use. Any other broadcast, publication, retransmission, copying, or storage, without written permission from the Editorium, is strictly prohibited. If you’re interested in reprinting one of our articles, please send an email message to editor@editorium.com

    Editorium Update is provided for informational purposes only and without a warranty of any kind, either express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, and freedom from infringement. The user (you) assumes the entire risk as to the accuracy and use of this document.

    The Editorium is not affiliated with Microsoft Corporation or any other entity.

    We do not sell, rent, or give our subscriber list to anyone. Period.

    If you’d like to subscribe, please enter your name and email address below. We publish the newsletter once a week, and on rare occasions we may send an important announcement. We never, ever send spam. Thank you for signing up!