Create a task in MS Project to reflect in Outlook

N

Nikki

Can anyone tell me if you can add a task in MS Project and have it create a
task reminder in outlook?
 
M

Maurice Birchler

I have this vba code that you will need to adapt.
It creates and updates (but does not delete) appointments in my calendar for
tasks that I am assigned to as a resource.
This code uses the Outlook Mileage field to store the Task Unique ID.
Good luck Sorry about the word wrapping in this reply. Try cut and paste
from here.

Sub Update_Outlook_Calander()

' Opens Maurices Outlook Calendar and updates or creates (but not deletes)

' any appointments with Location = ProjectName





'If project is empty, alert the user and end the macro

ProjectName = ActiveProject.Name



If ActiveProject.Tasks.Count > 0 Then

Set olMAPI = GetObject("", "Outlook.Application").GetNamespace("MAPI")

Set currFolder = olMAPI.Folders("Mailbox -
Maurice").Folders("Calendar")

For I = 1 To ActiveProject.Tasks.Count

CurrTaskResourceCount = ActiveProject.Tasks(I).Resources.Count

If ActiveProject.Tasks(I).ResourceNames Like "*Maurice*" Then

CurrTask = ActiveProject.Tasks(I)

CurrTaskID = ActiveProject.Tasks(I).UniqueID

CurrTaskNum = ActiveProject.Tasks(I).ID

CurrTaskResourceNames = ActiveProject.Tasks(I).ResourceNames

CurrTaskName = ActiveProject.Tasks(I).Name

' update with actual Start/Finish if task has these.

CurrTaskStart = ActiveProject.Tasks(I).ActualStart

CurrTaskFinish = ActiveProject.Tasks(I).ActualFinish

If CurrTaskStart = "NA" Then CurrTaskStart =
ActiveProject.Tasks(I).Start

If CurrTaskFinish = "NA" Then CurrTaskFinish =
ActiveProject.Tasks(I).Finish



'Call MsgBox(CurrTaskNum)

SearchStr = "[Location] = " & VBA.Chr$(34) & ProjectName &
VBA.Chr$(34) & _

" AND [Mileage] = " & VBA.Chr$(34) & CurrTaskID &
VBA.Chr$(34)

Set myAppointments = currFolder.Items

Set CurrAppointment = myAppointments.Find(SearchStr)

If TypeName(CurrAppointment) <> "Nothing" Then

'update this appointment

'Call MsgBox(CurrAppointment.Mileage)

CurrAppointment.Start = CurrTaskStart

CurrAppointment.End = CurrTaskFinish

'CurrAppointment.Mileage = CurrTaskID

'CurrAppointment.Location = ProjectName

CurrAppointment.Subject = CurrTaskName & " :" & CurrTaskID

CurrAppointment.Body = CurrTaskNum & vbCrLf &
CurrTaskResourceNames & vbCrLf & ActiveProject.Tasks(I).Notes

'CurrAppointment.ReminderSet = True

CurrAppointment.Save

' Are there splits from Palm Synch that need to deleted?

While TypeName(CurrAppointment) <> "Nothing"

Set CurrAppointment = myAppointments.FindNext

If TypeName(CurrAppointment) <> "Nothing" Then
CurrAppointment.Delete

Wend

Else

'create new appointment

Set CurrAppointment = myAppointments.Add

CurrAppointment.Start = CurrTaskStart

CurrAppointment.End = CurrTaskFinish

CurrAppointment.Mileage = CurrTaskID

CurrAppointment.Location = ProjectName

CurrAppointment.Subject = CurrTaskName & " :" & CurrTaskID

CurrAppointment.Body = CuurTaskNum & vbCrLf &
CurrTaskResourceNames & vbCrLf & ActiveProject.Tasks(I).Notes

CurrAppointment.ReminderSet = False

CurrAppointment.Save



End If

End If

Next I

End If

End Sub
 
N

Nikki

Thank you for the response and assistance. However, this is much to
technical for me. I am not familiar with VBA Coding. Thank you again for
trying to help.
 
M

Mark

I wish to use this code, but I am unsure how to execute it & how to put it
into Outlook. Are you able to help me do that?

I worked out the XML issue with greater and less than signs etc so I must be
doing something right ;)

Thanks
 
M

Mark

I have just worked out I need to do it in Project rather than in Outlook. But
when I try to run the code it stops on this line
"CurrTaskResourceCount = ActiveProject.Tasks(I).Resources.Count"
Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top