首页 > 解决方案 > 如何跟踪电子邮件何时分类?

问题描述

我们使用 Outlook 作为日常工作的主要工具。

它在员工为邮件分配类别时开始,并在发送此邮件时结束。

我想在发送邮件时提取邮件的分类时间(日期和时间,类别名称)以及此邮件的主题,并将其提取到 Excel 工作表中。

我计划将这样的宏添加到 ThisOutlookSession 中。我不知道如何从 Outlook 中提取类别事件。

我只能在发送电子邮件时提取?

标签: excelvbaemailoutlook

解决方案


您需要处理在对象的显式内置属性(例如Categories)发生更改时触发的PropertyChange事件。已更改的属性名称作为参数传递给事件处理程序。例如,原始草图:

 Private WithEvents olExplorer As Outlook.Explorer
 Private olCurSel As Selection
 Private WithEvents olCurSelItem As Outlook.MailItem

 Private Sub olExplorer_SelectionChange()
  Set olCurSel = olExplorer.Selection
  Set olCurSelItem = Nothing
   If TypeName(olCurSel.Item(1)) = "MailItem" Then
    Set olCurSelItem = olCurSel.Item(i)
   End If
 End Sub

 Private Sub olCurSelItem_PropertyChange(ByVal Name As String)
  Debug.Print Name
 End Sub

推荐阅读