The VBE consists of a number of parts. I briefly describe some of the key components in the sections that follow.
The VBE menu bar, of course, works like every other menu bar that you've encountered. It contains commands that you use to work with the various components in the VBE. Also, you'll find that many of the menu commands have shortcut keys associated with them. For example, the View ^ Immediate Window command has a shortcut key of Ctrl+G.
The VBE also features shortcut menus. As you'll discover, you can right-click virtually anything in a VBE window, and you'll get a shortcut menu of common commands.
The Standard toolbar, which is directly under the menu bar by default, is one of six VBE toolbars available; the menu bar is also considered a toolbar. VBE toolbars work just like those in Excel: You can customize toolbars, move them around, display other toolbars, and so forth. Choose the View ^ Toolbars ^ Customize command to work with VBE toolbars.
The Project Explorer window displays a tree diagram that consists of every workbook that is currently open in Excel (including add-ins and hidden workbooks). Each workbook is known as a project. I discuss the Project Explorer window in more detail in the next section ("Working with the Project Explorer").
If the Project Explorer window is not visible, press Ctrl+R. To hide the Project Explorer window, click the Close button in its title bar (or right-click anywhere in the Project Explorer window and select Hide from the shortcut menu).
A Code window (sometimes known as a Module window) contains VBA code. Every item in a project has an associated code window. To view a code window for an object, double-click the object in the Project Explorer window. For example, to view the code window for the Sheetl object, double-click Sheetl in the Project Explorer window. Unless you've added some VBA code, the Code window will be empty.
Another way to view the Code window for an object is to select the object in the Project Explorer window and then click the View Code button in the toolbar at the top of the Project Explorer window.
I discuss Code windows later on in this chapter (see "Working with Code Windows").
The Immediate window is most useful for executing VBA statements directly, testing statements, and debugging your code. This window might or might not be visible. If the Immediate window isn't visible, press Ctrl+G. To close the Immediate window, click the Close button in its title bar (or right-click anywhere in the Immediate window and select Hide from the shortcut menu).
Was this article helpful?