O'Reilly logo

Programming Excel with VBA and .NET by Steve Saunders, Jeff Webb

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Create Toolbars in Code

Because custom toolbars are easier to distribute than custom menus, there is less reason to create them in code; however, you can if you like. Toolbars are CommandBar objects, just like menus, but they have a Type property set to msoBarTypeNormal. You get a reference to a toolbar from the Application object’s CommandBars collection using the toolbar’s name. The toolbars are:

3-D Settings

Align or Distribute

Annotation Pens

AutoShapes

Basic Shapes

Block Arrows

Borders

Callouts

Chart

Chart Type

Circular Reference

Clipboard

Compare Side by Side

Connectors

Control Toolbox

Diagram

Draw Border

Drawing

Drawing and Writing Pens

Drawing Canvas

Envelope

Exit Design Mode

External Data

Fill Color

Flowchart

Font Color

Formatting

Forms

Formula Auditing

Full Screen

Ink Annotations

Ink Drawing and Writing

Insert Shape

Line Color

Lines

List

Nudge

Online Meeting

Order

Organization Chart

Pattern

Picture

PivotTable

PivotTable Field List

Protection

Refresh

Reviewing

Rotate or Flip

Shadow Settings

Standard

Stars & Banners

Stop Recording

Task Pane

Text To Speech

Visual Basic

Watch Window

Web

WordArt

  

Use the CommandBar object’s Show method to display a toolbar. For example, the following code displays each of the toolbars in turn, pausing between each. This is useful for finding the name of a particular toolbar:

Sub ShowToolbars( ) Dim cb As CommandBar, show As Boolean For Each cb In Application.CommandBars If cb.Type ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required