|< Day Day Up >|
You learned earlier in this chapter how you can use the macro recorder to generate Visual Basic code, but for more complicated macros, you will want to start in the VBE. You saw earlier how to open the VBE (by using Alt+F11) and use it to modify a macro. The following sections describe some features the VBE offers and how to work with them.
The Project Explorer
You saw the Project Explorer window earlier, when you were looking for the module where the macro you created was stored. The Project Explorer is typically docked in the upper-left corner of the screen. The top project is usually GLOBAL.MPT , and this is a good place to put macros you are working on or that you want to use across several projects.
It is good practice to back up your Global template file occasionally, especially if you have put a large amount of work or customization into it. You can back it up by simply copying it and storing it in a safe location.
Each project that is open in Project is shown in the Project Explorer window. You can copy modules between projects by dragging them from one project to the other. This serves the same purpose as using the Organizer within Project, but it does not require you to leave the VBE (see Figure 4).
Figure 4. When you are developing code, it can be helpful to store versions of the code in individual files rather than have them all exist in the Global template.
The Properties Window
The Properties window is positioned below the Project Explorer window, and it displays the properties for the item that is currently selected. You can edit properties in this window, and you can also use it when you want to name a specific module.
The Object Browser
The object browser is another essential window in the VBE. It displays all the objects that are available to you, including those from Office as seen in Figure 5. You can use it to browse through objects or search for them.
Figure 5. The Properties window is on the lower left, and the object browser is on the right.
|< Day Day Up >|