【发布时间】:2015-02-24 03:20:03
【问题描述】:
我在 Outlook 中有以下宏来清除我已删除的文件夹。这很奇怪,因为它似乎没有删除所有条目。我必须运行几次才能清除已删除的项目文件夹。 (通常是 2 或 3 次)。每次文件夹中已删除项目的数量确实减少了,但我不明白为什么所有内容都没有在第一时间被清除。
这是我的代码;有什么问题吗?
Public Sub EmptyDeletedEmailFolder()
Dim outApp As Outlook.Application
Dim deletedFolder As Outlook.MAPIFolder
Dim item As Object
Dim entryID As String
Set outApp = CreateObject("outlook.application")
Set deletedFolder = outApp.GetNamespace("MAPI").GetDefaultFolder(olFolderDeletedItems)
For Each item In deletedFolder.Items
item.Delete ' Delete from mail folder
Next
Set item = Nothing
Set deletedFolder = Nothing
Set outApp = Nothing
End Sub
【问题讨论】: