AddButton

Syntax

AddButton Toolbar$, Position, Category, Name$ [ButtonTxtOrImageNum[$]] [Context] [CommandValue$]

Remarks

Adds to a toolbar a button that runs a built-in command or macro, applies a font or style, or inserts an AutoText entry.

Argument

Explanation

Toolbar$

The name of the toolbar as listed in the Toolbars dialog box (View menu).

Position

A number corresponding to the position on the specified toolbar at which to add the button, where 1 is the first position, 2 is the second position, and so on. Note that a list box or space counts as one position.

Category

The type of item to be assigned:

1 Built-in commands

2 Macros

3 Fonts

4 AutoText entries

5 Styles

Name$

The name of the built-in command, macro, font, AutoText entry, or style to associate with the button. To add a space to a toolbar, specify an empty string ("").


Argument

Explanation

ButtonTxtOrImageNum[$]

The text you want to appear on the button, or a number corresponding to an image for the button in the built-in set of buttons, where 0 (zero) is no image (for a blank button), 1 is the first image, 2 is the second image, and so on. For a list of button images and their associated numbers, see "Toolbar Button Images and Numbers" in Help.

Context

Determines where the new toolbar assignment is stored:

0 (zero) or omitted Normal template

1 Active template

CommandValue$

Additional text, if any, required for the command specified by Name$. For example, if Name$ is "Color," CommandValue$ specifies the color. For more information, see the second table in ToolsCustomizeMenus.


Example

This example replaces the button at position 11 on the Formatting toolbar with button image 80. The built-in command assigned to the button is Color, which requires that an additional value be specified (in this case, "2" for the color blue).


DeleteButton "Formatting", 11, 0
AddButton "Formatting", 11, 1, "Color", 80, 0, "2"

See Also

ChooseButtonImage, CopyButtonImage, DeleteButton, EditButtonImage, MoveButton, PasteButtonImage, ResetButtonImage