Toolbars Method

Applies To

Application Object.

Description

Accessor. Returns an object that represents a single toolbar (a Toolbar object, Syntax 1) or a collection of toolbars (a Toolbars object, Syntax 2) in the current instance of Microsoft Excel. Read-only.

Syntax 1

object.Toolbars(index)

Syntax 2

object.Toolbars

object

Optional. The Application containing the toolbars.

index

Required for Syntax 1. The name or number of the toolbar.

Example

This example adds a new toolbar button to the first position on the Standard toolbar and then assigns the macro myNewButtonMacro to the button.


Set newButton = Toolbars("Standard").ToolbarButtons.Add _
    (Button:=210, Before:=1)
newButton.OnAction = "myNewButtonMacro"

This example resets all toolbars to their default configurations.


For Each tb In Application.Toolbars
    tb.Reset
Next tb