我在Outlook中有以下宏来清除我删除的文件夹。这很奇怪,因为它似乎并没有删除所有条目。我必须运行几次才能清除已删除的项目文件夹。 (通常2或3次)。每次在文件夹中删除的项目数量都会减少,但我不明白为什么一切都不会在第一时间消失。outlook宏 - 为什么不删除删除文件夹中的所有项目?
这是我的代码;哪里不对了?
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
这种有点奏效,但它有一个错误。我会修复你的答案。 。 – leora 2009-11-23 20:36:34
最新帖子现在有效。 。 。 – leora 2009-11-23 20:37:28
谢谢:) char,char – Fionnuala 2009-11-23 20:41:41