Skip to main content

Understanding VBE Components

The fastest way to activate VBE is to press Alt+F11 while Excel is active. To return to Excel, press Alt+F11 again. You can also activate the VBE by using the Visual Basic command found on Excel’s Developer tab.

The following figure shows some of the key components of the VBE program. Your VBE program window may look completely different from what you see in the figure below. VBE contains several windows and is highly customizable. You can hide windows, rearrange windows, dock windows, etc.

VBE Components

Menu Bar

VBE's menu bar contains commands that you can use to handle various components in VBE, and many menu commands have shortcut keys associated with them.

Toolbar

By default, the standard toolbar is directly below the menu bar. You can customize toolbars, move them around, show other toolbars, and more. If you wish, you can use the View > Toolbars command to display more toolbars.

Project Window

The Project window displays a tree view of every workbook currently open in Excel (including add-ins and hidden workbooks). Double-click items to expand or contract them.

If the Project window is not visible, press Ctrl+R or use the View > Project Browser command.

Code Window

The code window contains VBA code. Each object in a project has an associated code window. To view the code window for an object, double-click the object in the project window. For example, to see the code window for the Module1 object, double-click Module1 in the project window. The code window will be empty unless you have added some VBA code.

Immediate Window

If you can't see the Immediate Window, press Ctrl+G or use the View > Immediate Window command.

The Immediate Window is most useful when directly executing VBA statements and debugging code. If you're just starting out with VBA, this window isn't all that useful, so feel free to hide it to free up some screen space for other things.

Properties Window

The Properties window is located in the left vertical pane near the bottom of the VBE. If you don't see the Properties window in VBE, press F4, or click View > Properties Window from the VBE menu bar. This window displays a list of properties and their assigned values for any object selected in the Project Explorer window.

Locals Window

If you can't see the Locals Window, use the View > Locals Window command.

Automatically displays all of the declared variables in the current procedure and their values.

When the Locals window is visible, it is automatically updated every time there is a change from run time to break mode or you navigate in the stack display.

Watches Window

If you can't see the Watches Window, use the View > Watch Window command.

Appears automatically when watch expressions are defined in the project. Drag a selected variable to the Immediate window or the Watch window.

Object Browser

If you can't see the Object Browser, press F2 or use the View > Object Browser command.

A dialog box in which you can examine the contents of an object library to get information about the objects provided.

Displays the classes, properties, methods, events, and constants available from object libraries and the procedures in your project. Use it to find and use objects you create, as well as objects from other applications.

You can get Help for the Object Browser by searching for Object Browser in Help.

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>