L
landro
Hello,
using excel VBA I send task planning to my colleagues.
Sometimes I need to update the task or to delete it but i'm not able.
My code lines are:
-----
Sub DeleteTaxDayShared()
Dim objOL As Outlook.Application
Dim objNS As Outlook.Namespace
Dim strFind As String
Dim objCalFolder As Outlook.MAPIFolder
Dim colCalendar As Outlook.Items
Dim objAppt As Outlook.TaskItem
Dim myRecipient As Outlook.Recipient
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Set myRecipient = objNS.CreateRecipient("(e-mail address removed)")
myRecipient.Resolve
If myRecipient.Resolved Then
Set objTaskFolder =
objNS.GetSharedDefaultFolder(myRecipient,olFolderTasks)
Set colTask = objTaskFolder.Items
strFind = "[Subject] = " & Chr(34) & "Tax Day" & Chr(34)
Set objTask = colTask.Find(strFind)
If Not objTask Is Nothing Then
objTask.Delete
End If
End If
Set objOL = Nothing
Set objNS = Nothing
Set objCalFolder = Nothing
Set colCalendar = Nothing
End Sub
-----
I receive runtime error on:
Set objTaskFolder = objNS.GetSharedDefaultFolder(myRecipient,
olFolderTasks)
Thanks.
using excel VBA I send task planning to my colleagues.
Sometimes I need to update the task or to delete it but i'm not able.
My code lines are:
-----
Sub DeleteTaxDayShared()
Dim objOL As Outlook.Application
Dim objNS As Outlook.Namespace
Dim strFind As String
Dim objCalFolder As Outlook.MAPIFolder
Dim colCalendar As Outlook.Items
Dim objAppt As Outlook.TaskItem
Dim myRecipient As Outlook.Recipient
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Set myRecipient = objNS.CreateRecipient("(e-mail address removed)")
myRecipient.Resolve
If myRecipient.Resolved Then
Set objTaskFolder =
objNS.GetSharedDefaultFolder(myRecipient,olFolderTasks)
Set colTask = objTaskFolder.Items
strFind = "[Subject] = " & Chr(34) & "Tax Day" & Chr(34)
Set objTask = colTask.Find(strFind)
If Not objTask Is Nothing Then
objTask.Delete
End If
End If
Set objOL = Nothing
Set objNS = Nothing
Set objCalFolder = Nothing
Set colCalendar = Nothing
End Sub
-----
I receive runtime error on:
Set objTaskFolder = objNS.GetSharedDefaultFolder(myRecipient,
olFolderTasks)
Thanks.