Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Reading out the tasks from MS Outlook to MS Project

$
0
0

Hi,

I little while ago, I made a macro that enables me to send tasks from my project in MS Project to Outlook of my workers. Now, when a tasks has changed its status, I recieve immediately the response. What I need is a macro that will read out all of the tasks that I sent, and that only belong to the project that is currently open, and update the start/end time and the percentage complete, nothing else.

I found a similar macro already and adjusted it a little bit for my needs but it doesn't work as needed:

Sub recieveOutlookTaskEmails()

    Dim appOL As Outlook.Application
    Dim mspTask As MSProject.Task
    Dim objTask As Outlook.TaskItem, objTaskFolder As Outlook.MAPIFolder
    Dim objTaskItems As Outlook.Items, objNS As Outlook.NameSpace
    Dim i As Integer
    
    i = 0
    
    On Error Resume Next
    Set appOL = GetObject(, "Outlook.Application")
    Set objNS = appOL.GetNamespace("MAPI")
    Set objTaskFolder = objNS.GetDefaultFolder(olFolderTasks)
    Set objTaskItems = objTaskFolder.Items
    
    For Each objTask In objTaskItems
        If objTask.Categories = mspTask.Project Then
            SetTaskField Field:="Start", Value:=objTask.StartDate, AllSelectedTasks:=True
            SetTaskField Field:="PercentComplete", Value:=objTask.PercentComplete, AllSelectedTasks:=True
            SetTaskField Field:="Finish", Value:=objTask.DueDate, AllSelectedTasks:=True
            i = i + 1
        Else
            Debug.Print "Outlook task " & objTask.Subject & " - Aktualisierung Fehler"
        End If
    Next
    
    Application.CalculateAll
    
    Set objTask = Nothing
    
    MsgBox i & " Tasks wurden aktualisiert."
    
    Set objTaskItems = Nothing
    Set objTaskFolder = Nothing
    Set objNS = Nothing
    Exit Sub

End Sub

When I run the macro, it says that XX tasks were updated but I don't see any updates (atleast not the percentage compelte). What am I doing wrong and where is the problem?

Thanks!





Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>