Hi,
I've been working on a code to take dates from an Excel spreadsheet and to create a task in Outlook using that date. I have the code running, unfortunately, it saves to my personal, default Task list in Outlook. I want to change that so it goes to a task list named SupplyChainTasks...I assume it has something to do with line 13, where it says GetDefaultFolder, but, I don't know how to change that without getting a run-time error. Here's a small portion of the code that I have:
Sub Create_Task()
Dim olApp As Outlook.Application
Dim olNs As Namespace
Dim Fldr As MAPIFolder
Dim olTsk As TaskItem
Dim j As Long
Dim k As Long
Dim otaskitem As Outlook.TaskItem
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderTasks)
Set otaskitem = olApp.CreateItem(olTaskItem)
Application.ScreenUpdating = False
k = 0
For Each olTsk In Fldr.Items
j = 0
If olTsk.Body = Sheets("Sheet1").Range("A" & Sheets("Link").Range("A2").Value) Then
j = 1
If j = 1 Then
k = 1
End If
The code goes on, but, I think my problem is in the beginning here. I'm just not sure how to "find" a non-default outlook folder (not sure if I also need to change any .Items references either).
Thanks!
Bookmarks