Cycling through Outlook Folder viewing Tasks:   Return to List

Private Sub ViewTasks()
Dim MyNS As NameSpace
Dim objItem As Object
Dim objOutlook As New Outlook.Application
Dim strTask As String
Dim TaskFolder As MAPIFolder

Set MyNS = objOutlook.GetNamespace("MAPI")
Set TaskFolder = MyNS.Folders("Personal Folders").Folders("TaskFolders").Folders("PersonalTasks")

For Each MyItem In TaskFolder.Items
    If objItem.Class = 48 Then' 48 is the class for Task
        strTask = objItem.Body
        If InStr(strTask, "whatever") > 0 Then
       ' Do whatever with Task
        End If
    End If
Next
End Sub



Note to Webmaster