Working with Menus

Just like toolbars, menus are CommandBar objects. There are two types of menus: built-in and shortcut. The built-in menu appears at the top of the application window, just below the title bar. In Microsoft Excel 2002, there are two built-in menus: Worksheet menu bar and Chart menu bar.

The Worksheet menu bar appears when a worksheet is active (Figure 12-4) and lists several main menus. Each of the main menus groups options related to specific tasks that can be performed in a worksheet or workbook. For example, the Format menu contains options allowing the application of various types of formatting to the worksheet. Some menu options have more detailed options that are grouped in a submenu (Figure 12-5).

Worksheet Menu Bar

File Edit View Insert Format lools Data Window Help Type a question for help

Figure 12-4: The built-in "Worksheet Menu Bar" in Microsoft Excel

0 Microsoft Excel - Chapl2

B] He Edit View Insert Fotmat

Tools Data Window Help

Spelling,,, F7

s^fr Error Checking...

Share Workboc*

JaijiJ

Type a question for help ».fix

protection oohr» collaboration Formula Audtiriq TOOlS Oh the Web... Macro

Protect Sheet-., Allow Users to Edit Ranges... 55) Protect Workbook...

Prciectand £hare Workbook...

Figure 12-5: Selecting a menu option with a triangle on the right-hand side reveals a submenu with more choices.

When the user works with the chart sheet or selects a chart embedded in a worksheet, the Worksheet Menu Bar is replaced with the Chart Menu Bar (Figure 12-6). Only one menu bar can appear at a given time in the application window.

Chart Menu Bar

File Edit View Insert Format lools Chart Window Help Type a question for help t . fl x

Figure 12-6: The built-in "Chart Menu Bar" in Microsoft Excel

A shortcut menu appears when you right-click on an object or press Shift+F10. Microsoft Excel 2002 has over 50 shortcut menus. A shortcut menu contains frequently used commands. For example, when you right-click any worksheet cell, the Cell shortcut menu appears (Figure 12-7). Right-clicking a worksheet tab displays the standard menu for worksheet tabs (Figure 12-8).

$

Cut

s

Copy

ffi

Paste

Paste Special...

Insert...

Delete...

Clear Contents

¡13

Insert Comment

us1

Format Cells...

Pick From List...

Add Watch

Hyperlink...

Figure 12-7: This shortcut menu appears when you right-click any cell.

Insert...

Delete

Rename

Move or Copy...

Select All Sheets

Tab Color...

View Code

Figure 12-8: This shortcut menu appears when you right-click a sheet tab.

Figure 12-8: This shortcut menu appears when you right-click a sheet tab.

Menu bars, much like toolbars, are represented by the same object— CommandBar. Use the Control object to refer to the menus, menu options, submenus, and shortcut menus. The type of the Control object is determined by an appropriate constant. Use the msoControlPopup to refer to the menu, the msoControlButton constant to refer to the menu options, and the msoBarPopup constant to refer to the shortcut menu. You will learn how to use these constants in the next section.

0 0

Post a comment