Microsoft Office Tutorials and References
In Depth Information
Things to Know about Objects
Read the rest of the topic
Don’t forget, the name of this chapter is “Introducing Visual Basic for Applications.” The remainder
of this topic covers many additional details and provides many useful and informative examples.
Record your actions
The absolute best way to become familiar with VBA, without question, is to simply turn on the
macro recorder and record some actions that you perform in Excel. This approach is a quick way
to learn the relevant objects, properties, and methods for a task. It’s even better if the VBA
module in which the code is being recorded is visible while you’re recording.
Use the Help system
The main source of detailed information about Excel’s objects, methods, and procedures is the
Help system. Many people forget about this resource.
Use the Object Browser
The Object Browser is a handy tool that lists every property and method for every object available.
When the VBE is active, you can bring up the Object Browser in any of the following three ways:
h Press F2.
h Choose the View ➜ Object Browser command from the menu.
h Click the Object Browser tool on the Standard toolbar.
The Object Browser is shown in Figure 7-15.
The drop-down list in the upper-left corner of the Object Browser includes a list of all object
libraries that you have access to:
h Excel itself
h MSForms (used to create custom dialog boxes)
h Office (objects common to all Microsoft Office applications)
h Stdole (OLE automation objects)
h The current project (the project that’s selected in the Project Explorer) and any
workbooks referenced by that project
Your selection in this upper-left drop-down list determines what is displayed in the Classes window,
and your selection in the Classes window determines what is visible in the Members Of panel.