![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I have a macro in MS Project that moves all the Project tasks to Outlook.
Now I need to be able to loop through all the tasks in Outlook so that I can gather status info and use it to update MS Project. But I can't figure out a way to get a reference to each Outlook task. Can anyone help? I will gladly post the MSProject-to-Outlook-task code if anyone wants to see it. Thanks, Rick Williams |
Ads |
#2
|
|||
|
|||
![]()
You can iterate through all the Tasks in the default Tasks folder using a
macro like this: Sub LoopThroughTasks() Dim objTask As Outlook.TaskItem, objTaskFolder As Outlook.MAPIFolder Dim objTaskItems As Outlook.Items, objNS As Outlook.NameSpace Set objNS = Application.GetNamespace("MAPI") Set objTaskFolder = objNS.GetDefaultFolder(olFolderTasks) Set objTaskItems = objTaskFolder.Items For Each objTask In objTaskItems Debug.Print objTask.Status 'Returns value of olTaskStatus constants: 'olTaskComplete 2 'olTaskDeferred 4 'olTaskInProgress 1 'olTaskNotStarted 0 'olTaskWaiting 3 Next Set objTask = Nothing Set objTaskItems = Nothing Set objTaskFolder = Nothing Set objNS = Nothing End Sub -- Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "Rick Williams" wrote: I have a macro in MS Project that moves all the Project tasks to Outlook. Now I need to be able to loop through all the tasks in Outlook so that I can gather status info and use it to update MS Project. But I can't figure out a way to get a reference to each Outlook task. Can anyone help? I will gladly post the MSProject-to-Outlook-task code if anyone wants to see it. Thanks, Rick Williams |
#3
|
|||
|
|||
![]()
Thank you very much, Eric!
Rick Williams "Eric Legault [MVP - Outlook]" wrote in message ... You can iterate through all the Tasks in the default Tasks folder using a macro like this: Sub LoopThroughTasks() Dim objTask As Outlook.TaskItem, objTaskFolder As Outlook.MAPIFolder Dim objTaskItems As Outlook.Items, objNS As Outlook.NameSpace Set objNS = Application.GetNamespace("MAPI") Set objTaskFolder = objNS.GetDefaultFolder(olFolderTasks) Set objTaskItems = objTaskFolder.Items For Each objTask In objTaskItems Debug.Print objTask.Status 'Returns value of olTaskStatus constants: 'olTaskComplete 2 'olTaskDeferred 4 'olTaskInProgress 1 'olTaskNotStarted 0 'olTaskWaiting 3 Next Set objTask = Nothing Set objTaskItems = Nothing Set objTaskFolder = Nothing Set objNS = Nothing End Sub -- Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "Rick Williams" wrote: I have a macro in MS Project that moves all the Project tasks to Outlook. Now I need to be able to loop through all the tasks in Outlook so that I can gather status info and use it to update MS Project. But I can't figure out a way to get a reference to each Outlook task. Can anyone help? I will gladly post the MSProject-to-Outlook-task code if anyone wants to see it. Thanks, Rick Williams |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to apply vba code to OL2003 forms ? | TimR | Outlook - Using Contacts | 1 | February 17th 06 05:41 PM |
Delete Custom Outlook Control thru Access VBA | Sue Mosher [MVP-Outlook] | Outlook - Using Forms | 0 | January 20th 06 06:29 PM |
Outlook Connector for Domino and VBA question | [email protected] | Outlook and VBA | 0 | January 18th 06 09:56 AM |
Can I use VBA to activate a hyperlink in Outlook? | [email protected] | Outlook and VBA | 2 | January 18th 06 01:57 AM |
List of Outlook References Through VBA | David | Outlook - General Queries | 0 | January 11th 06 12:53 AM |