0
我有一段代碼可以刪除特定文件夾中的所有電子郵件,但我只需要它刪除超過90天的電子郵件,並希望有人將能夠幫助我,我在下面列出了代碼;Outlook VBA,如何刪除90天以前的電子郵件
Sub RemoveAllItemsAndFoldersInDeletedItems()
Dim oDeletedItems As Outlook.Folder
Dim oFolders As Outlook.Folders
Dim oItems As Outlook.Items
Dim i As Long
'Obtain a reference to deleted items folder
Set oDeletedItems = Application.Session.GetDefaultFolder(olFolderDrafts)
Set oItems = oDeletedItems.Items
For i = oItems.Count To 1 Step -1
oItems.Item(i).Delete
Next
Set oFolders = oDeletedItems.Folders
For i = oFolders.Count To 1 Step -1
oFolders.Item(i).Delete
Next
End Sub
你可以只設立一個收件箱規則來做到這一點。 – braX
是的,但我被要求設置一個帶有宏的按鈕來做到這一點? –