如何在 Outlook 中为同一对话中的所有邮件自动设置相同的颜色类别

立即分享:

如果你想为同一对话中的所有邮件设置相同的颜色类别,你可以利用本文介绍的一段VBA代码来实现它。

为了更好地对邮件进行分类和管理,您可能习惯应用颜色分类。 此外,如果您有很多会话,即 Outlook 中的电子邮件线程,为了更好地识别一个会话中的电子邮件,您可能希望对同一会话中的所有邮件应用相同的颜色类别。 毫无疑问,手动将颜色类别设置为电子邮件线程非常繁琐。 因此,为什么不让 Outlook 在对对话中的电子邮件进行分类时自动为其余邮件分配相同的颜色类别? 您可以使用下面的一段 VBA 代码来实现它,而不费吹灰之力。

自动为 Outlook 中同一对话中的所有邮件设置相同的颜色类别

自动为同一对话中的所有邮件设置相同的颜色类别

  1. 一开始,您应该启动 Outlook 应用程序。
  2. 然后在 Outlook 主窗口中,按“Alt + F11”键按钮。
  3. 接下来您将访问 Outlook VBA 编辑器窗口,您应该在其中找到并打开“ThisOutlookSession”项目。
  4. 随后,将以下 VBA 代码复制到该项目窗口中。
Public WithEvents objExplorer As Outlook.Explorer
Public WithEvents objMail As Outlook.MailItem

Private Sub Application_Startup()
    Set objExplorer = Outlook.Application.ActiveExplorer
End Sub

Private Sub objExplorer_SelectionChange()
    On Error Resume Next
    If objExplorer.Selection.Item(1).Class = olMail Then
       Set objMail = objExplorer.Selection.Item(1)
    End If
End Sub

Private Sub objMail_PropertyChange(ByVal Name As String)
    Dim objConversation As Outlook.Conversation
    Dim objStore As Outlook.Store
    Dim strCategories As String
 
    'When assigning color categories to the currently selected mail
    If Name = "Categories" Then
       strCategories = objMail.Categories
 
       Set objStore = objMail.parent.Store
 
       If objStore.IsConversationEnabled Then
          'Get the conversation
          Set objConversation = objMail.GetConversation
 
          If Not (objConversation Is Nothing) Then
             'Assign the same color categories to the mails in this conversation
             objConversation.SetAlwaysAssignCategories strCategories, objStore
          End If
       End If
    End If
End Sub

VBA 代码 - 自动为同一对话中的所有邮件设置相同的颜色类别

  1. 之后,您应该签署此代码。
  2. 稍后,您需要更改 Outlook 宏安全设置以允许数字签名的宏。
  3. 最后,您可以重启 Outlook 应用程序来激活此宏。
  4. 从现在开始,每当您为对话中的一封邮件分配任何颜色类别时,Outlook 都会自动将相同的颜色类别分配给该对话中的其余电子邮件。

谨慎地处理您的 PST 文件

与 Word 文档或 Excel 电子表格一样,PST 文件同样容易受到攻击。 因此,为了防止 PST 数据损坏并避免困难 PST修复, 你最好一直照顾好你的 PST 文件。 例如,您需要注意您在 Outlook 中的日常操作并定期备份您的 PST 文件。 此外,如果可能,您可以准备一个卓越的工具,例如 DataNumen Outlook Repair 提前。

作者简介:

Shirley Zhang 是一位数据恢复专家 DataNumen, Inc.,它是数据恢复技术领域的世界领先者,包括 中密度纤维板修复 和 outlook 修复软件产品。 欲了解更多信息,请访问 datanumen.com

立即分享:

评论被关闭。