[英]How to track when email is categorized and sent via vba in outlook?
I had such a problem: In my company we are using outlook as a main tool for daily work.我遇到了这样一个问题:在我的公司,我们使用 Outlook 作为日常工作的主要工具。 The whole things starts when emploee assigned a category to mail and ends when this mail is sent.
整个事情从员工为邮件分配一个类别开始,并在发送此邮件时结束。 I would like to extract data when particular mail was categorized (date and hour, name of category) and when it was send (the same like previously) + subject of this mail, to excel worksheet.
我想在对特定邮件进行分类(日期和时间,类别名称)以及何时发送(与以前相同)+这封邮件的主题时提取数据,以生成 Excel 工作表。 I have planned to add such macro into ThisOutlookSession but currently i had no idea how to extract category events from outlook, i've been able only extract info when email was send.
我计划将这样的宏添加到 ThisOutlookSession 但目前我不知道如何从 Outlook 中提取类别事件,我只能在发送电子邮件时提取信息。 Any advice?
有什么建议吗?
You need to handle the PropertyChange event which is fired when an explicit built-in property (for example, Categories ) of the object is changed.您需要处理在更改对象的显式内置属性(例如Categories )时触发的PropertyChange事件。 The name of the property that was changed is passed as a parameter to the event handler.
更改的属性的名称作为参数传递给事件处理程序。 For example, a raw sketch:
例如,原始草图:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.