What are you starting now?


I recently came across this interesting question from Algola in MPUG Discussion Forum

http://www.mpug.com/forums/topic/filter-activities-that-can-start/

In other words, the solution should work for the below scenarios
Scenario 1: Unstarted tasks without any predecessors

Scenario 2: Unstarted tasks with all predecessors 100% complete

Let me demonstrate how this can be done using VBA Macros

1. Click View tab. Click Macros dropdown and select Visual Basic

image12.png?w=640

2. In the editor, double click your current project on the left panel. This will display the code editor.
3. Now, insert a procedure named ReadyToStart by selecting Insert menu, and then Procedure.

4. Inside the ReadyToStart procedure, write this code to loop through all the tasks in the current project

5. We will now use the Marked field to indicate whether the task is ready to start or not. If the current task is not yet started, set Marked to True otherwise False

6. If the current task is not yet started then check if predecessors, if any, are completed or not

7. After marking the tasks, we will now highlight these tasks by creating a filter Ready To Start

The complete code is shown below

8. Now to run this macro click View tab. Click Macros dropdown and select View Macros. Select the macro ReadyToStart and click Run button

Advertisements

What is driving your decisions?


I recently came across this interesting question from Thomas in LinkedIn MS Project Schedule group

https://www.linkedin.com/groups/Milestone-predecessor-filtering-2552040.S.5929005434290593795

The simplified version of his requirement: Filter all milestones in the next 6 months along with its immediate predecessors. In the below plan, the current date falls in October and his requirement is to highlight Go Live 1, Build 1 and Build 2 (as Go Live 1 is the only milestone in the next 6 months and its immediate predecessor are Build 1 and Build 2)

I evaluated different options such as (a) custom fields with formula, (b) custom filters, (c) write VBA code. The first two options was eliminated as the formula can test only the current task and cannot test its predecessor tasks. To test the task and its predecessor, VBA macros is the solution.

Let’s start with a pseudocode
1. For each task in plan do
1.1. If task is not empty and active
1.1.1. If the task is milestone and is happening in the next 6 months
1.1.1.1. Mark the milestone to True
1.1.1.2. For each predecessor of the current task
1.1.1.2.1. Mark the current predecessor to True
2. Highlight all the tasks with Marked as True

Now you need to translate each statement by using Project model object, properties and methods.
1. Click View tab. Click Macros dropdown and select Visual Basic

image12.png?w=640

2. In the editor, double click your current project on the left panel. This will display the code editor.
3. Now, insert a procedure named FindMilestonesAndImmediatePredecessors by selecting Insert menu, and then Procedure.

4. Let’s first loop through all the tasks in the current project

5. Now mark the current task if it is non-empty active task and milestone happening in the next 6 months.

6. Now loop through the immediate predecessor of the milestone and mark these tasks

7. After marking the milestones and its immediate predecessors, you can highlight these tasks by creating a filter MilestonesAndImmediatePredecessors

The complete code is shown below

8. Now to run this macro click View tab. Click Macros dropdown and select View Macros. Select the macro FindMilestonesAndImmediatePredecessors and click Run button

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

Your Personal Assistant: Project can remind the tasks due this week


In my earliest post, you learnt how to write event procedures for Project and Application object. In this post, I will focus on a very simple tip – "How to highlight the tasks due this week every time the project plan is opened?".

Looks very simple and it is indeed very simple.

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

2. In the editor, double click your current project on the left panel.

3. Now change the object and procedure to "Project" and "Open".

4. This will include a private sub-routine which will be invoked when the file is opened

5. Within this sub-routine, include the below script

6. Close the editor, and close the project

Open the project file, and Project will highlight the incomplete tasks that should be completed by this week.

Stop! Don’t delete approved tasks


In my earliest post, you learnt about how to use Calculate Event procedure in the Project object to color tasks with no dependencies set. The events of Project are available for any open project – reference http://msdn.microsoft.com/en-us/library/office/dn217671(v=office.15).aspx

You have a more powerful object called Application. It represents the entire Project application. To write event procedures for the Application object, you must follow a new approach.

Let’s take an example to illustrate Application object’s event procedure. As a best practice, it is advisable not to delete baseline tasks since you will lose the evidence and will have incorrect variance. It is hence recommended to Inactivate the task (see this blog about the benefits).

Design and Build tasks is approved and Test task is inserted later.

After deleting Build task, you lost the proof that Build was part of your plan

The following steps will guide you how to create event handler before a task is deleted

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 "ProjectBeforeTaskDelete". ProjectBeforeTaskDelete event will be fired for every task that is deleted.

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

The code displays the message "Dont’ delete baseline task. Instead Inactivate the task" and cancels the delete action if the Baseline Start of the task deleted is set.

Get alerted when tasks have no dependencies set


In my previous blog post "Highlight items after every change", you have learnt how to apply highlight the tasks after every change by using Visual Basic for Applications macro.

Best practice followed when linking tasks is (a) Don’t link summary tasks to summary task – as it complicates the scheduling logic, (b) Every other task should have at least one predecessor or successor task.

It is easy to validate the above provide your plan is small (this is quite relative again 🙂 ). In this blog post, I will walk through on how VBA macros can color tasks automatically with no dependencies set and color summary tasks with dependencies set.

In the above plan, you can notice I have violate the first rule (a) Phase 1 (task id 1) is linked to Phase 2 (task id 4), (b) Go Live (task id 7) is not linked to any other tasks

Let’s start with a pseudocode for this requirement.

1. For each task in plan do
1.1. If task is not empty and active
1.1.1. If the task is summary task
1.1.1.1. If number of dependencies is greater than zero, then mark it.
1.1.2. If the task is not summary task
1.1.2.1. If number of dependencies is zero, then mark it
2. Color the marked task

Now you need to translate each statement by using Project model object, properties and methods.

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

2. In the editor, double click your current project on the left panel.
3. Now change the object and procedure to "Project" and "Calculate".

4. This will include a private sub-routine which will be invoked automatically after calculation!!

5. Within this sub-routine, include the below script

The above sub-routine checks if the current view is Gantt Chart. Then, it changes the text styles of marked tasks (Item:=5) to default color. Then, we loop through the task list and mark the tasks having the issues.

After closing the editor, I just retyped a task information and Project automatically colors the task that need attention in red.

Highlight items after every change


Project 2013 gives features to highlight, filter and group tasks on certain conditions. These commands are available in View ribbon.

I have selected the criteria "Critical" in Highlight list, and Project highlights the critical tasks with yellow background color.

Wonderful!!

Now, I changed the duration of Build 2 to 4 days. This task doesn’t get highlighted though it is part of the critical path. Why?

After selecting the criteria, Project applies it only once in the current view. In other words, Project doesn’t refresh the view after every change.

You need to write a small script that will be apply the filter after every change, and this is quite simple.

1. Click View tab. Click Macros dropdown and select Visual Basic

2. In the editor, double click your current project on the left panel.
3. Now change the object and procedure to "Project" and "Change".

4. This will include a private sub-routine which will be invoked automatically after every edit!!

5. Within the sub-routine, include the below script. This code applies the Critical filter if the current view is "Gantt Chart"
If pj.CurrentView = "Gantt Chart" Then
FilterApply Name:="Critical", Highlight:=True
End If

6. Close the editor.

Now, I changed the duration of Build 2 to 5 days and Project automatically highlights the critical tasks 🙂

Make % Complete and % Work Complete Independent


In my earlier post "The Purpose of ‘% Complete’ field", I mentioned how % Complete, % Work Complete and Physical % Complete are different from each other.

By default, updating % Complete will update % Work Complete as seen below

Is there a way to make % Complete and % Work Complete independent?

Click Project, Options. Select Schedule tab. Clear "Updating Task Status updates Resource Status" checkbox in Calculation options for this project: section.

Now, updating actual duration, remaining duration or even % Complete will not update % Work Complete, Actual Work, Remaining Work of the task

In the above example, updating % Complete to 50% will not update % Work Complete which needs to updated manually.

Difference between Scheduled Start/Scheduled Finish and Start/Finish


Start and Finish fields is often called as the current/schedule start and finish.

In Project 2007 and earlier versions, these fields are adjusted based on calendar, predecessor and constraints. These fields are date fields.

In Project 2010 and later version, Microsoft introduced the Task Mode. This special field can be set to Manually Scheduled or Auto Scheduled.

By default, new tasks are created as Manually Scheduled tasks. This means their Duration, Start, Finish will be empty. This implies Start and Finish fields are text fields and not date fields.

When you link this task to another task, Project will default the duration to 1 day?, and calculate the Start and Finish field, but this will happen only once. Are you wondering why does this done only once? In File, Options, Schedule tab, by default "Update Manually Scheduled tasks when editing links" is checked.

I have written another post "The Little Benefits of Manually Scheduled Tasks". As mentioned in this post, Project draws a green wavy or red wavy line below the Finish date to tell the task needs to finish early or needs to finish late.

Without changing the task mode, how to see the recommended start and finish of the manually scheduled task?

Scheduled Start and Scheduled Finish fields displays the recommended Start and Finish as calculated by Project based on dependencies, constraints and calendars. This field can be used in custom formula and conditions.

What are you finishing today?


Project 2013 ships with "Tasks Due This Week" filter. This filter shows detail tasks with finish between the start and end of the current week.

What if you want to display the tasks due today?

1. On the View tab, click the down arrow of the Filter box to display the drop-down menu and then select New Filter in the menu to open the Filter Definition dialog box.
2. Enter the name "Tasks Due Today" and set the filter criteria as it is seen below and click Save:

The value string “Today is:”? evaluates to the Current Date field entered in Project Information dialog box. If we use a different prompt string, for example, "Enter a date:"?, then the filter asks for a date to compare with the task finish dates.

3. On the View tab, select the filter "Tasks Due Today" from Highlight: dropdown (by default "No Highlight" is applied)

So, what are you finishing today?