OOM & VBA : How to delete Outlook recurring Task items (whose status marked as Completed)
'[VBA & Outlook Object Model : Code snippet to delete Outlook recurring Task items (whose status marked as Completed)]
'Declaration part
...
dim otaskitem as Outlook.Taskitem
dim ofolder as Outlook.Folder
'Get the Task items
set ofolder = Application.Session.GetDefaultFolder(olFolderTasks)
For each item in ofolder.items
set otaskitem = Item
'Check the status of the specific Taskitem is "Completed" or not
if otaskitem.Status = olTaskcomplete then
'Msgbox "Completed Tasks"
otaskitem.Delete
else
'Msgbox "Not Completed Tasks"
end if
Next
....
Comments
Anonymous
April 09, 2009
PingBack from http://asp-net-hosting.simplynetdev.com/oom-vba-how-to-delete-outlook-recurring-task-items-which-status-are-completed/Anonymous
April 23, 2009
I need to squeeze the code in a good looking & working too... Done the changes ... For each item in ofolder.items set otaskitem = Item 'Check the status of the specific Taskitem is "Completed" or not if otaskitem.Status = olTaskcomplete then 'Msgbox "Completed Tasks" otaskitem.Delete 'else 'Msgbox "Not Completed Tasks" end if Next ... 'Finally don't forget to release the objects