If you are a Project Manager, or have in any way been involved in a project which require you to use Project 2003, there is probably a time when you wish for some way to export your Project tasks out into Outlook 2003. There is an easy way to import Outlook task into Project 2003, but not the other way round. It seem more natural and obvious to have tasks defined and sorted out in Project 2003 first, and have them exported into Outlook for your action.
The simpliest way around this problem is to use VBA. Appended below are 2 simple VBA scripts, one for exporting from Project to Outlook, and the other to update the status from Outlook back to Project:
'#1 - From Project to Outlook
'To be saved into Project 2003 as macro
Sub ExportTask()
Dim appOL As Outlook.Application
Dim mspTask As MSProject.Task
Dim olTask As Outlook.TaskItem
Dim TaskFolder As MAPIFolder
Dim checkTask As String
Dim i As Integer, j As Integer
On Error GoTo objError
Set appOL = GetObject(, "Outlook.Application")
resumeplace:
Set TaskFolder = appOL.GetNamespace("MAPI").GetDefaultFolder(olFolderTasks)
For Each mspTask In MSProject.ActiveSelection.Tasks
If Not (mspTask Is Nothing) And Not (mspTask.Summary = True) Then
checkTask = "[Subject] = """ & mspTask.Name & """"
If TaskFolder.Items.Find(checkTask) Is Nothing Then
Set olTask = appOL.CreateItem(olTaskItem)
olTask.Subject = mspTask.Name
olTask.Body = mspTask.Notes
olTask.StartDate = mspTask.EarlyStart
olTask.DueDate = mspTask.EarlyFinish
olTask.Status = olTaskNotStarted
'olTask.Categories = "Work"
olTask.Categories = Left(MSProject.ActiveProject.Name, Len(MSProject.ActiveProject.Name) - 4)
olTask.Mileage = mspTask.ID
olTask.ReminderSet = False
olTask.Save
Set olTask = Nothing
i = i + 1
Else
MsgBox "[" & mspTask.Name & "] already existed, task skipped"
End If
End If
Next
MsgBox "Export completed. " & i & " tasks were exported to Outlook."
Exit Sub
objError:
Err.Clear
Set appOL = CreateObject("Outlook.Application")
GoTo resumeplace
End Sub
'#2 - From Outlook to Project
'To be saved into Outlook 2003 as macro
Sub UpdateTask()
Dim appPro As MSProject.Application
Dim mspTask As MSProject.Task
Dim olTask As Outlook.TaskItem
Dim TaskFolder As MAPIFolder
Dim checkTask As String
Dim i As Integer, j As Integer
On Error GoTo objError
Set appPro = GetObject(, "MSProject.Application")
resumeplace:
'Get the category first - matched to the name of the project
If Outlook.Application.ActiveExplorer.CurrentFolder = "Tasks" Then
For i = 1 To Outlook.Application.ActiveExplorer.Selection.Count
Set olTask = Outlook.Application.ActiveExplorer.Selection.Item(i)
If olTask.Mileage <> "" Then
'Set mspTask = appPro.ActiveProject.Tasks(CInt(olTask.Mileage))
If appPro.Projects.Count = 0 Then
MsgBox "Please open Project first before proceeding"
Exit For
Else
Set mspTask = appPro.Projects.Item(olTask.Categories).Tasks(CInt(olTask.Mileage))
mspTask.PercentComplete = olTask.PercentComplete
End If
Else
MsgBox "[" & olTask.Subject & "] is not a Project task. Task skipped."
End If
j = j + 1
Next
MsgBox "Update completed. " & j & " tasks were updated to Project."
Else
MsgBox "Please select [Task] folder before running"
End If
Exit Sub
objError:
Err.Clear
Set appPro = CreateObject("MSProject.Application")
GoTo resumeplace
End Sub
You have to have both Project 2003 and Outlook 2003 to be open to prevent unneccessary troubleshoots. Simply paste the relevant scripts into its respective application. You can create a hotkey to execute the Project 2003's macro from the options menu in the macro page
As for outlook, assign a button to that macro and have it placed on your toolbar for easy access
To export out from Project into Outlook, simply select your tasks, and do a "Ctrl E". A few days later, when you're done with your task, mark them as 'completed' in Outlook and click the 'Update Project' to have its Project's counterpart updated.
I hope these simple VBA scripts will help enhance your productivity.