Creating Custom Toolbars


Menu commands are fine, but there's nothing like a toolbar's one-click access for making your macros easy to run. This section shows you how to create custom toolbars, populate them with buttons, and assign macros to these buttons.

Customizing an Existing Toolbar

If you want to make changes to one of the application's existing toolbars, display the toolbar, select Tools, Customize to load the Customize dialog box, and then use the following techniques:

  • To move a button to a different location, drag it within the toolbar.

  • To change the size of a toolbar drop-down list, click-and-drag either the left or right edge.

  • To change how the application displays a toolbar button, right-click the button and then choose one of the following commands from the shortcut menu:

    • Default Style Uses the application's default style (only the button's image is shown).

    • Text Only (Always) The button displays text (that is, the button name) whether it's displayed in a toolbar or on a menu.

    • Text Only (in Menus) The button displays text only when it's displayed on a menu.

    • Image and Text The button displays both its image and its name.

  • To delete a button, drag it off the toolbar.

Creating a New Toolbar

Theoretically, you could add new buttons to the application's built-in toolbars, but you run the risk of overcrowding them and possibly confusing your users. Instead, you can create a toolbar from scratch and add existing commands and custom buttons to it. Here are the steps to follow to create a new toolbar:

1.

Select Tools, Customize to display the Customize dialog box.

2.

Activate the Toolbars tab.

3.

Click New. The New Toolbar dialog box appears.

4.

Use the Toolbar Name text box to type the name you want to use for the toolbar.

5.

In Word only, use the Make Toolbar Available To list to assign the new toolbar to a template.

6.

Click OK. The application displays a new, empty toolbar.

Creating a New Menu Bar

There is no practical difference between a menu bar and a toolbar. (In fact, you can drag the menu bar from its top docking position and turn it into a floating toolbar.) Therefore, you can use the steps for creating a custom toolbar to create a custom menu bar as well.


Custom Toolbar Maintenance

After you've created a custom toolbar, activate the Toolbars tab in the Customize dialog box and then use the following techniques to work with it:

  • To rename the toolbar, highlight it in the Toolbars list, click Rename, and then type the new name into the dialog box that appears.

  • To delete the toolbar, highlight it in the Toolbars list and click Delete. When the application asks you to confirm the deletion, click OK.


Adding a Toolbar Submenu or Toolbar Button

After you have created your new toolbar, you can start adding submenus and buttons to it. This is the same as adding submenus and commands to a drop-down menu, so just follow the procedures described earlier. In this case, of course, you drag the menus, built-in commands, or macros and drop them on the toolbar of your choice.

Working with Button Images

If you add a button for a macro to a toolbar, you can leave the button as text, but you might prefer to assign a custom image. You can do this in three ways:

  • Copy an image from another button.

  • Use one of the application's predefined images.

  • Use the Button Editor to edit an existing image or create an image from scratch.

Copying a Button Image

If another toolbar button has an image you want to use, follow these steps to copy the image and assign it to your custom button:

1.

Select Tools, Customize to display the Customize dialog box and then select the Commands tab.

2.

Display the toolbar that contains the button image you want, if it's not already displayed.

3.

Right-click the button that contains the image you want.

4.

Click Copy Button Image.

5.

Right-click the button whose image you want to change.

6.

Click Paste Button Image.

Assigning a Predefined Button Image

The Office applications come with more than 40 predefined button images that you can assign to your custom toolbar buttons. Follow these steps:

1.

Select Tools, Customize to display the Customize dialog box and then select the Commands tab.

2.

Right-click the button whose image you want to change.

3.

Click Change Button Image.

4.

In the submenu that appears, click the image you want.

Using the Button Editor

The Office Button Editor lets you modify an existing button image or create your own. The following procedure shows you how it's done:

1.

Select Tools, Customize to display the Customize dialog box.

2.

Right-click the button whose image you want to edit.

Starting with Another Button Image

If another toolbar button has an image that's close to the one you want, use the steps outlined earlier in the "Copying a Button Image" section to copy that image to your button. You can then edit this image as necessary using the Button Editor.


3.

Click Edit Button Image. The application displays the Button Editor dialog box, shown in Figure 10.5.

Figure 10.5. The Button Editor lets you design your own toolbar buttons.


4.

If you want to create the button from scratch, click the Clear button.

5.

Select a color by clicking one of the boxes in the Colors group.

6.

Add the color to the image by clicking one or more boxes in the Picture area. To clear a box, click it again. The Preview area shows you what the button looks like at regular size.

7.

If necessary, use the buttons in the Move group to adjust the position of the image.

8.

Repeat steps 5 through 7 to draw the complete image.

9.

Click OK to assign the new image to the button.

Attaching a Toolbar to an Excel Workbook

If you're working in Excel and you need a custom toolbar only for a specific workbook, you can attach the toolbar to the workbook. This is also useful for developers who want to distribute custom toolbars with their projects. Here are the steps to follow:

1.

Activate the workbook to which you want to attach the custom toolbar.

2.

Select Tools, Customize to display the Customize dialog box and then select the Toolbars tab.

3.

Click Attach. Excel displays the Attach Toolbars dialog box.

4.

Select the custom toolbar and click Copy >>.

5.

Click OK.

After you've attached a toolbar, it's automatically copied into the Excel workspace whenever you open the workbook.

Removing a Toolbar from a Workbook

If you accidentally copy a toolbar, you can remove it from the workbook. Display the Attach Toolbars dialog box and then select the toolbar in the Toolbars in Workbook list. The Copy >> button changes to a Delete button. Click Delete to remove the toolbar, and then click OK.




Tricks of the Microsoft Office Gurus
Tricks of the Microsoft Office Gurus
ISBN: 0789733692
EAN: 2147483647
Year: 2003
Pages: 129

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net