我的收件箱规则为零。在阅读电子邮件时,我将其移动到另一个文件夹,因此收件箱中的所有内容都是新的和/或可操作的。如果可行,我通常会执行操作并快速归档电子邮件,以使我的收件箱尽可能保持空。
这是我的基本宏。它将消息窗格中的选定消息或当前打开的消息移动到“归档个人文件夹” PST文件的“收件箱”文件夹中。如果您的PST文件名和文件夹不同,则必须更改。我在主Outlook工具栏和“阅读邮件窗口”工具栏上创建宏按钮。最好也对宏进行签名。
Sub MoveSelectedMessagesToArchiveInbox()
On Error Resume Next
Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objNS.Folders("Archive Personal Folders").Folders("Inbox")
'Assume this is a mail folder
If objFolder Is Nothing Then
MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER"
End If
Select Case TypeName(Outlook.Application.ActiveWindow)
Case "Explorer"
If Application.ActiveExplorer.Selection.Count = 0 Then
'Require that this procedure be called only when a message is selected
Exit Sub
End If
For Each objItem In Application.ActiveExplorer.Selection
If objFolder.DefaultItemType = olMailItem Then
If objItem.Class = olMail Then
objItem.Move objFolder
End If
End If
Next
Case "Inspector"
Set objItem = Outlook.Application.ActiveInspector.CurrentItem
If objFolder.DefaultItemType = olMailItem Then
If objItem.Class = olMail Then
objItem.Move objFolder
End If
End If
Case Else
' Do Nothing
End Select
Set objItem = Nothing
Set objFolder = Nothing
Set objInbox = Nothing
Set objNS = Nothing
End Sub