I am trying to create a userform to manage my tasks in Outlook. The first step is to get all of the tasks into a listbox which I have called iInbox. I found the code below on the internet, and modified it, but it does not seem to do anything.
Any ideas?
Any ideas?
Code:
Sub FillInbox()
Dim olApp As Outlook.Application
Dim olNs As NameSpace
Dim Fldr As MAPIFolder
Dim olTsk As TaskItem
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderTasks)
For Each olTsk In Fldr.Items
iInbox.AddItem (olTsk.Subject)
Next olTsk
Set olTsk = Nothing
Set Fldr = Nothing
Set olNs = Nothing
Set olApp = Nothing
End Sub