Protecting Baseline Fields


Baseline refers to approved estimates. After you have set the baseline in Project, the approved estimates can be displayed by inserting the Baseline fields such as Baseline Start, Baseline Finish, Baseline Work, Baseline Cost and Baseline Duration. Depending on the view these columns are inserted, Project can either display the approved estimates of tasks, resources or assignments

In Gantt Chart view, you can see the approved estimates of the tasks

In Task Usage view, you can see the approved estimates of tasks as well as its assignments

In Resource Sheet view, you can see the approved estimates of resources

Project does not have feature to lock the approved estimates. You can change the baseline fields and Project doesn’t stop you from doing that.

A better solution is capture the event and having VBA handlers for it.

1. Click View tab. Click Macros dropdown and select Visual Basic
image12.png?w=640

2. In the Visual Basic Editor, on the option menu for VBAProject, choose Insert, and then choose Class Module to create a class named Class1.

3. You can rename the class module in the Properties pane. In the following examples, the class is named Events.

4. You must create a new object using the WithEvents keyword in a class module
Public WithEvents App As Application
5. If you user changes the task related fields, the event ProjectBeforeTaskChange is fired. So, change the object and procedure to App and ProjectBeforeTaskChange respectively

6. If you user changes the assignment related fields, the event ProjectBeforeAssignmentChange is fired. So, change the object and procedure to App and ProjectBeforeAssignmentChange respectively

7. If you user changes the resource related fields, the event ProjectBeforeResourceChange is fired. So, change the object and procedure to App and ProjectBeforeResourceChange respectively

8. You need to bind the current Application object to the App object declared in the class to fire the events. Open the ThisProject module and paste the below code. This code declares an object X of type Events (the class module we created earlier), and sets the current Application object to the App object of Events class module

8. Save the changes.
10. Save the plan and close Project.

Now, reopen the plan (why? the application object is set in Project_Open event handler) and make change to the baseline fields. Project will not accept the change and you need to press Escape key to cancel the edit

Advertisements

I Know What You Did Last Summer


This post is not about the horror movie but about “I Know What You Did Last Update”

i-know-what-you-did-last-summer.jpg

Project 2013 includes Created field to tell the date and time when the task or resource was added to your plan

In Gantt Chart view …

In Resource Sheet view …

Every time you update your plan, you lose track of which ones you updated. The problem is Project doesn’t have a field to tell when the task is last updated.

You need to write a small VBA to code to handle this requirement. We will be using a custom date field (Date1) to store the current date and time when the task is updated and here is how it goes.

1. Click View tab. Click Macros dropdown and select Visual Basic
image12.png?w=640

2. In the Visual Basic Editor, on the option menu for VBAProject, choose Insert, and then choose Class Module to create a class named Class1.

3. You can rename the class module in the Properties pane. In the following examples, the class is named Events.

4. You must create a new object using the WithEvents keyword in a class module
Public WithEvents App As Application
5.┬áNow change the object and procedure to “App” and “ProjectBeforeTaskChange”. ProjectBeforeTaskChange event will be fired for every task that is changed
Capture

6. Within this sub-routine include the below code

7. You need to bind the current Application object to the App object declared in the class to fire the events. Open the ThisProject module and paste the below code. This code declares an object X of type Events (the class module we created earlier), and sets the current Application object to the App object of Events class module

8. Save the changes.
9. Insert Date1 column in Gantt Chart. Right the column and select Custom Fields. In Custom Fields dialog, rename Date1 to Modified

10. Save the plan and close Project.

Now, reopen the plan (why? the application object is set in Project_Open event handler) and make some changes the tasks. You will notice the Modified column will get updated to current date and time