Do you have permissions to open that Tasks folder? Can you do it using the
UI?
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
wrote in message
ps.com...
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 a
-----
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 = ")
myRecipient.Resolve
If myRecipient.Resolved Then
Set objTaskFolder =
objNS.GetSharedDefaultFolder(myRecipient,olFolderT asks)
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.