Microsoft Office Tutorials and References
In Depth Information
Working with Visual Basic Editor
The shortened version works because the Application option is
the default parent object used if you don’t specify a parent object
before CurrentProject. (The Application object is the parent
of CurrentProject because CurrentProject is a member of the
Application object library.)
The bottom line is that when you see a bunch of words separated by dots
in code, such as CurrentProject.AllForms.Count, be aware that those
words refer to some object. In a sense, the words are a path to the object, going
from the largest object down to a single specific object, property, method, or
event. You can use the Object Browser as a means of looking up the meanings
of the words to gain an understanding of how the prewritten code works.
As you gain experience, you can use the Object Browser to look up
information about objects, collections, properties, methods, events, and constants
within your code. For now, consider the Object Browser to be a tool for
discovering VBA as you go.
Choosing object libraries
Most likely, the object libraries that appear automatically in the Object
Browser’s Project/Library drop-down menu are all you need. Should a given
project require you to add some other object library, however, follow these
steps to add it:
1. Choose Tools ➪ References in Visual Basic Editor.
The References dialog box opens.
2. Select any library in the list.
In the unlikely event that you need a library that isn’t in the list — but
you know that you stored it on your hard drive — click the Browse
button, navigate to the folder that contains the object library you need,
click its name, and then click the Open button.
3. Click OK when you’ve selected all the object libraries that you need.
The Project/Library list in the Object Browser now includes all the
libraries that you selected in the References dialog box.
Closing Visual Basic Editor
When you’re done working in Visual Basic Editor, you can close it by using
whichever of the following techniques is most convenient for you:
✦ Choose File ➪ Close, and return to Microsoft Access from the VBE main
✦ Click the Close button in the top-right corner of the VBE program window.