Microsoft KB Archive/101621

= Microsoft Knowledge Base =

Excel: Macro Commands to Show or Hide All Toolbars
Last reviewed: September 12, 1996

Article ID: Q101621

The information in this article applies to:


 * Microsoft Excel for Windows, versions 4.0, 4.0a
 * Microsoft Excel for the Macintosh, version 4.0

In Microsoft Excel version 4.0, you can use the SET.NAME and IF macro commands to show or hide all available toolbars.

To show all available toolbars, use the following lines of macro code:

A1: =SET.NAME("AllToolbars",GET.TOOLBAR(8)) A2: =IF(ISERROR(AllToolbars),,SHOW.TOOLBAR(AllToolbars,TRUE)) where:


 * Cell A1 gets the names of all available toolbars and stores the names as an array in the name AllToolbars.
 * Cell A2 checks to make sure that at least one toolbar exists in AllToolbars and, if so, shows all toolbars.

NOTE: Both lines should be entered as array formulas. In Microsoft Excel for Windows press CTRL+SHIFT+ENTER after you type the formula. In Microsoft Excel for the Macintosh, press COMMAND+RETURN.

To hide all available toolbars, use the following lines of macro code:

A1: =SET.NAME("AllToolbars",GET.TOOLBAR(8)) A2: =IF(ISERROR(AllToolbars),,SHOW.TOOLBAR(AllToolbars,FALSE)) where:


 * Cell A1 gets the names of all available toolbars and stores the names as an array in the name AllToolbars.
 * Cell A2 checks to make sure that at least one toolbar exists in AllToolbars and, if so, hides all toolbars.

Again, both lines must be entered as array formulas.