When you're working in the VBE, each Excel workbook and add-in that's currently open is considered a project. You can think of a project as a collection of objects arranged as an outline. You can expand a project by clicking the plus sign (+) at the left of the project's name in the Project Explorer window. You contract a project by clicking the minus sign (-) to the left of a project's name. If you try to expand a project that's protected with a password, you'll be prompted to enter the password.
The top of the Project Explorer window contains three buttons. The third button, named Toggle Folder, controls whether the objects in a project are displayed in a hierarchy or are shown in a single non-hierarchical list.
Figure 7-4 shows a Project Explorer window with three projects listed (one add-in and two workbooks).
When you activate the VBE,you cannot assume that the code module that's displayed corresponds to the highlighted object in the Project Explorer window. To make sure that you're working in the correct code module, always double-click the object in the Project Explorer window.
If you have many workbooks and add-ins loaded, the Project Explorer window can be a bit overwhelming. Unfortunately, you can't hide projects in the Project Explorer window. However, you'll probably want to keep the project outlines contracted if you're not working on them.
Every project expands to show at least one node called Microsoft Excel Objects. This node expands to show an item for each worksheet and chart sheet in the workbook (each sheet is considered an object), and another object called ThisWorkbook (which represents the ActiveWorkbook object). If the project has any VBA modules, the project listing also shows a Modules node, and the modules are listed there. A project can also contain a node called Forms that contains UserForm objects (also known as custom dialog boxes). If your project has any class modules, it will display another node called Class Modules.
Was this article helpful?