Useful Tools When Learning the Object Model

Although there are many different ways to learn your way around the object model, there are three tools that can make doing so much easier:

Auto List Members. This option for the Visual Basic Editor (enabled by default) automatically lists all methods, properties, events, and children for an object as you type your code. Besides saving additional typing—you can just select the item you want from the list—this option can help you learn about a relevant portion of the object model as you work (see Figure 31-8).

Figure 31-8. The Auto List Members box, shown here displaying part of the list for the Application object, is great way to learn about the object model as you work.

Tip How object-oriented code relates to the object model

When you see a period between two object names in Visual Basic code, such as Applica-tion.Projects or ActiveCell.Task.Assignments, you have "branched" from one section of the object model to another.

If you think of the object model as a tree with the Application object as its root, this "dot syntax" of object-oriented code is not only a useful reminder that you've moved from one "branch" to another, but it can actually help you understand the relationships between items in the object model.

Microsoft Project Visual Basic Reference. Whether you use it with the object browser, use it while writing code, or just browse its contents, the Visual Basic reference for Microsoft Project contains everything you need to know about the object model.

There are graphical representations of the object model hierarchy, full explanations of the members of the Microsoft Project object model—including links to Help topics about the other object models automatically referenced by a project—and many examples showing the object model "in action."

I, l(T Object Browser. The object browser (see Figure 31-9) displays all the items (properties, methods, events, and so on) in every object model that is referenced by your Object project. Open it by pressing F2 or clicking the Object Browser button.

Browser

Object Browser

EBB

|<flll Libraries;- jrJ _< > | ' f |

1

Classes

Members of Application'

0 <globals>

About a

© AnswerWizard

s» ActivateMicrosoflApp

¡¡Si AnswerWizardFiles

là1 ActlveCell

©[Application

(Si1 Active Project

H2S Assignment

là1 ActlveSelection

© Assignments

(Si1 ActiveWindow

m Assistant

AddProgressLine

Auxiliary

AddResourcesFromProjectServer

i*J Availabilities

^ Alerts

EÎ9 Availability

là1 AMText

© Balloon

Êi1 AnswerWizard

BalloonCheckbox

SjApp Execute

© BalloonCheckboxes

(Si1 Application

',} BalloonLabel

P AppllcationBeforeClose

© BalloonLabels

AppMaximize

0 Calendar

^ AppMlnlmlze

¡S3 Calendars

App Move

© Cell

AppRestore v

Function AppExecute([lVj'flctowi [Command], [Minimize], [yicfjVate]) As Boolean

Member of MSProiect.Application

Figure 31-9. The object browser displays information about the libraries referenced by your project.

The object browser has three panes. The pane on the left is a list of classes. A class can be one of several things, including an object, collection, module, type (a user-defined data type), or enumerated data type (a collection of constants; usually referred to as an enum).

Clicking a class displays a list of members for the class in the pane on the right. In the figure just shown, one of the members of the Application object is selected.

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment