Advance Programming In Project 2000 Project Management Help

For the bulk of this book, you’ve been learning how to do things yourself in Project 2000. In Chapter 22, “Creating Project 2000 Macros,” you started learning to teach Project to complete tasks using the Macro Recorder. The Macro Recorder is teaching by example. Programming is teaching by instruction.

In this chapter, you will spend less time showing Project how to do it and more time telling Project how to do it. Before you can ex!?lain things to Project NBA, you will need to learn about the way VBA views Project.In this chapter, you’ll have the opportunity to create two applications: a Charged

Cost Application and a Linked Expenses application. Project Is not an accounting program, so it doesn’t have built-in support for job costing and estimating for external customers. The rate and fixed cost information entered in a Project 2000 project file can reflect our internal cost for a project or the prices that we’d charge to customers, but not both.

The Charged Cost application allows you to track two sets of costs within one project so you can generate reports for internal and external use. To do this, we’ll use two rate tables and some code that switches between the two. Although we built (and actually use) this application to track internal and external costs, this is not the limit of its use.

The Charged Cost application could also be used for testing different scenarios when planning a project: “Should we build our new line of widgets in our Kalamazoo plant or in our Springfield plant.

The Linked Expenses application demonstrates linking Project 2000 task fields to external sources. The Linked Expenses application was designed to link the Fixed Cost field of a task to a cell in an Excel workbook to look up distance information. After you examine the application, you can create similar applications to retrieve information from Excel, Access, and other data sources for use in Project 2000.

Understanding the Project Object Model

Every application that can be automated with Visual Basic has an object model. The object model is a road map to the objects in the application that have been exposed that can be used in VB automation. By now, you should understand the Project object model  you have been reading about it and working with it for the last The structure of the Project Object model mirrors the structure of Yo’low, for example, that before you can create a task, you need to have a project opened. Likewise, in VByou will need a Project object before you can create a Task object. There’s a term for the relationship between the two: the Project object is the parent object for the Task Object.

Project 2000 exposes many more objects than prior versions of Project. Exposed objects can be used in a VBA module attached to a project document or called from other programs such as Excel, Word, and Visual Basic to automate actions within Project. An application’s ActiveX object model is your reference guide to the objects that you can use in programming code. The ActiveX object model is hierarchical in structure like the Windows folder structure. For example, the Project Object contains collections of task objects and resource objects because a project file can contain tasks and resources.

The Project Object is the parent object of both the Task Object and the Resource Object. Figure 25.1 details the hierarchy of the Project object model.

TheProject Object

The Project Object

Two objects in the structure (the Application Object and the Project Object) are publicly creatable; the others are not. Apublicly creatable object can be created outside the native application. When Project 2000 is automated from another application, such as
an Excel VBA Project, new instances of the application and project objects can be created using the Create Object function. You can also create new instances of the Application and Project objects from within Project 2000 using the New keyword in the variable declaration or a Set statement. From Excel or any other VB-aware application, you can create a new Project 2000 Application Object or Project Object or work with existing items. in a project file. You can’t create a new task, however, using the Create Object function. Project 2000 objects, other than the Application Object and Project Object (such as task and resource objects) have to be created by using methods of a parent object. For example, to create a task, you rely on the parent Project Object and use the Add method of the Tasks collection of the Project object.

The Project object model generally has two types of objects: objects that represent items and objects that represent collections of items.

We’re assuming that you’re fairly familiar with the terminology that Project 2000 uses to refer to items and fields. If you think of the way that you normally use’ the application, the object model should be easy to understand. For example, a project has a number of tasks. On a task’s dialog box, there is a tab where a number of resources have been assigned to the task and a tab that lists the task’s predecessors (tasks that the task depends on). Here’s how these relationships are reflected in the Project object model:

A Project object has a Tasks collection filled with Task objects.
• A Task object has an Assignments collection with Assignment objects
• The Task also has a Dependency Tasks collection with Dependency Task objects.

As we noted  the hard part about automating Project 2000 or any other application isn’t understanding Visual Basic-it’s understanding the application. In the next section, we’ll examine the objects in the Project object model and their events in detail. As you read through this section, you’ll find that the object. model directly reflects the way Project 2000 operates .

Posted on November 26, 2015 in Advance Programming In Project 2000

Share the Story

Back to Top

Pin It on Pinterest

Share This