# Export Microsoft Project Tasks to Outlook

Clearly and Simply claims to be a blog on “intelligent data analysis, modeling, simulation and visualization”, and most of the posts are indeed discussing these topics. From time to time, however, I intersperse a post on project management, since project management activities always come along with most of my projects to a greater or lesser extent.

I suppose this might be the case in your professional life as well. A couple of months ago I published a post on how to export a Gantt chart from Microsoft Project to Microsoft PowerPoint. This post was extremely well received by our readers. Thus, I thought publishing another article on how to export from mpp files to other Microsoft Office applications might do no harm.

The purpose

The purpose of the little tool is pretty simple: If you are in charge of managing a large project or if you are somehow part of such a project, you are probably responsible for at least some tasks and milestones within this project. I would assume, you do not look into the project plan every day, but for sure you are opening Microsoft Outlook every morning. By having all relevant milestones and tasks as appointments or tasks in your Outlook pst file, you make sure not to forget about them, since Outlook will remember you automatically.

Agreed, you can put the appointments and tasks into Outlook manually as well, but having a tool to do this comes in handy especially if it is a real big project. This little tool provides such a simple and time-saving feature.

How-to

As soon as you have the VBA code (see below) in your Microsoft Project file, exporting tasks and milestones to Outlook is a piece of cake: Simply select the tasks and milestones you want to export by clicking on the row headers. You can select non-continuous rows by keeping the ctrl-key pressed. Your Microsoft Project file will look like this:

In this example, we selected all milestones. You will notice an additional menu called “Export to Outlook” in the main menu of Microsoft Project. If you – for instance – choose “Selection to Outlook appointments”, the tool will export all selected milestones to Outlook as appointments.

The result

Let’s assume you do not only convert the milestones of your project plan to Outlook appointments (as described above), but also export the tasks of “sub-project 1” to Outlook tasks and the 3 sub-projects to Outlook notes. Your Outlook will look like this:

This is the view of the notes in Microsoft Outlook, but as you can immediately see, the milestones are in Outlook as appointments, the tasks of sub-project 1 are in your task list and there is a note for each sub-project.

Please don’t be confused by the look and feel. I created this screenshot using a German version of Outlook 2007. The tool should work with earlier versions of Microsoft Office and other language packages as well.

The VBA code

The VBA code to do this is pretty simple and it is available in the file posted for download below. Thus I am limiting myself to show only a small explanatory part of the code:

Option ExplicitPublic myOLApp As Outlook.ApplicationSub Export_Selection_To_OL_Appointments()Dim myTask As TaskDim myItem As Outlook.AppointmentItemOn Error Resume NextSet myOLApp = CreateObject("Outlook.Application")For Each myTask In ActiveSelection.TasksSet myItem = myOLApp.CreateItem(olAppointmentItem)With myItem.Start = myTask.Start.End = myTask.Finish.Subject = myTask.Name & " (Project Task)".Categories = myTask.Project.Body = myTask.Notes.SaveEnd WithNext myTaskEnd Sub

As I said, it is pretty simple: Create an Outlook Application Object, run through all tasks in the Active Selection of Microsoft Project, create an Outlook appointment (respectively a task or a note) and assign the values of the Microsoft Project task to this appointment.

That’s it.

The procedures for tasks and notes are pretty similar. All you need on top of this is some code to create and delete the additional item in the main menu.

The tool has been tested using Microsoft Project Standard 2003 and Microsoft Outlook 2007. Please let me know if there are any issues with other versions.

Final remark

I have to admit that I am using this tool solely to export milestones to appointments. But for the sake of completeness, I included the export to tasks and notes as well. Maybe some of you might find them useful.

What’s next?

The next couple of posts will discuss data analysis and visualization topics again. But as already mentioned, from time to time I will post on project management as well.

Stay tuned.

Update on October 4, 2009:

A couple of readers had difficulties using this little tool with different versions of Outlook or Project (see the comments below). As Jimmy Peña already pointed in the first comment to this post (see below), the root cause for this are missing or wrong references to the object libraries. Jimmy recommends to make the code late bound. Here is a version using late bound code for free download: