Searching the Object Library

The real beauty of the Object Browser lies in its ability to help you find information about an object on an as-needed basis. Because you probably won't know what library an object resides in, choose <All Libraries> from the Project/Library drop-down list before you begin a search. Then you need to know what name you're searching for.

For example, as you can discover a little later in this book, Access offers a DoCmd (do command) object that lets VBA perform any option (command) on any menu in Access's menu bar. Suppose you're writing some code and need some quick information about that object. You could get that information by searching the Object Browser as follows:

1. In the Search box of the Object Browser, type the word you're searching for.

For example, to search for information on the DoCmd object, type the word DoCmd as the word to search for.

2. Click the Search button (binoculars) next to the Search box.

The results of your search appear in a Search Results pane under the Search box.

3. To get help with an item in the Search Results pane, click a name there and then click the Help (question mark) button on the Object Browser toolbar.

The Help text appears in a separate Help window, as in the example shown in Figure 2-10.

Admittedly, the Help text is technical documentation, written more for programmers than for VBA beginners. But you won't be a beginner for long, and knowing how the search the Object Browser will soon become a valuable skill.

Like other tools that I describe in this chapter, you can close the Object Browser (as well as any open Help window) at any time by clicking its Close (X) button.

I suppose right about now you're wondering how any of the tools in this chapter will make your life easier. I'm working up to that. For now, just being aware of the various panes and windows in the VBA is a good start. Knowing that VBA works by manipulating objects in object libraries is a good thing too. Even just being aware that the Object Browser and Help windows exist will be valuable as you start writing code.

Writing code is the actual programming part of VBA. You write VBA code to automate activities. And you automate activities by manipulating objects via object libraries. It's a lot of fancy buzzwords. But if you just think of object libraries as steering wheels that VBA can grab onto and steer, you'll be ahead of the game. Hop to Chapter 3 to start writing code.

Search Results pane

Help button

Help window

Search Results pane

Help button

Help window

Figure 2-10:

Search the Object Browser for help.

Figure 2-10:

Search the Object Browser for help.

0 0

Post a comment