Hello Gurus
So far I have created a macro (code below) that when run deletes emails directly from the 'Drafts' folder, however I want to add the condition that it only deletes emails 'older than 2 days old'. Can anyone advise on how I can add this into my macro below.
All help greatly appreciated.
David.
-------------------------
Public Sub EmptyDraftsEmailFolder()
Dim outapp As Outlook.Application
Set outapp = CreateObject("outlook.application")
Dim olitem As Object
Dim fldDrafts As Outlook.MAPIFolder
Set fldDrafts = outapp.GetNamespace("MAPI").GetDefaultFolder(olFolderDrafts)
For Each olitem In fldDrafts.Items
olitem.Delete
Next
Set fldDrafts = Nothing
Set olitem = Nothing
Set outapp = Nothing
End Sub
---------------------------------------
So far I have created a macro (code below) that when run deletes emails directly from the 'Drafts' folder, however I want to add the condition that it only deletes emails 'older than 2 days old'. Can anyone advise on how I can add this into my macro below.
All help greatly appreciated.
David.
-------------------------
Public Sub EmptyDraftsEmailFolder()
Dim outapp As Outlook.Application
Set outapp = CreateObject("outlook.application")
Dim olitem As Object
Dim fldDrafts As Outlook.MAPIFolder
Set fldDrafts = outapp.GetNamespace("MAPI").GetDefaultFolder(olFolderDrafts)
For Each olitem In fldDrafts.Items
olitem.Delete
Next
Set fldDrafts = Nothing
Set olitem = Nothing
Set outapp = Nothing
End Sub
---------------------------------------