Macro Sheets Only
Adds one or more buttons to a toolbar.
Syntax
ADD.TOOL(bar_id, position, tool_ref)
Bar_id is either a number specifying one of the built-in toolbars or the name of a custom toolbar.
Bar_id Built-in toolbar
1 Standard
2 Formatting
3 Query and Pivot
4 Chart
5 Drawing
6 TipWizard
7 Forms
8 Stop Recording
9 Visual Basic
10 Auditing
11 WorkGroup
12 Microsoft
13 Full Screen
Position specifies the position of the button within the toolbar. Position starts with 1 at the left side (if horizontal) or at the top (if vertical).
Tool_ref is either a number specifying a built-in button or a reference to an area on the macro sheet that defines a custom button or set of buttons (or an array containing this information). For a complete list of built-in buttons and their corresponding numbers, see Appendix D, "Toolbar Buttons in Microsoft Excel," in the Microsoft Excel Visual Basic User's Guide.
For customized buttons, the following example shows the components of a button reference area on a macro sheet and defines custom tools. The range A1:I5 is a valid tool_ref. Row 1 refers to a built-in tool. Row 2 defines a gap. For this illustration, values are displayed instead of formulas so that text can wrap in cells.
To indicate that a particular component of tool_ref is not used, clear the contents of the corresponding cell.
Remarks
ADD.TOOL(bar_id, position, {tool_id1, macro1, down1, enabled1, face1,
status_text1, balloon_text1, help_topics1;tool_id2, macro2, down2, enabled2,
face2, status_text2, balloon_text2, help_topics2;...})
Examples
The following macro formula adds a button to Toolbar5. The cell range B6:I6 contains tool_ref.
ADD.TOOL("Toolbar5", 6, B6:I6)
The following macro formula adds the New Macro Sheet button to the fifth position on the Standard toolbar:
ADD.TOOL(1, 5, 6)
Related Functions
ADD.COMMAND Adds a command to a menu
ADD.TOOLBAR Creates a toolbar with the specified tools
DELETE.TOOL Deletes a button from a toolbar
DELETE.TOOLBAR Deletes custom toolbars
RESET.TOOLBAR Resets a built-in toolbar to its default initial setting
List of Customizing Functions