Microsoft Project - Convert All SubTasks to Automatic Scheduling using Macros

Posted in software by Christopher R. Wirz on Sat Apr 07 2012

Many projects and teams are moving from the waterfall methodology to agile. As the iteration cycle of agile is intended to be shorter, there is a stronger focus on work vs schedule. A major tool of choice for project managers is Microsoft Project - and making the agile transition may have its complexities - and today we'll address one of those.

Most MS Project files default to manually schedule tasks based on duration and allocation. While this is a valid approach, many developers use the Kanban tool for the agile process - which assigns hour estimates to tasks. It would be much more convenient if everything matched.

Fortunately, there is an easy way to do this using macros in MS Project.

The first step is to ensure your project file is macro-enabled. Then open the visual basic editor (alt+f11) and create a new module. Inside the module, you can use the following code:


Sub ConvertAllSubtasksToFixedWork()
	' Macro ConvertAllSubtasksToFixedWork
	' Wed 4/7/10 by Wirz, Christopher R
    For Each t In ActiveProject.Tasks
        If Not t Is Nothing Then
            If t.Subproject <> "" Then
                SubProjId = t.ID
            ElseIf Not t.Summary Then
                SelectRow Row:=SubProjId + t.ID, rowrelative:=False
				' Set to fixed work
                SetTaskField Field:="Type", Value:="Fixed Work", AllSelectedTasks:=True
				' Set to auto-schedule
                SetTaskField Field:="Task Mode", Value:="No", AllSelectedTasks:=True
            End If
        End If
    Next t
End Sub

What's next? Go ahead and try it yourself in your own projects that are transitioning to agile. You can also download the .bas file to get started faster.