使用此代码响应主题为“test”的电子邮件...
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If TypeName(Item) = "MailItem" Then
Debug.Print Item.Subject
Debug.Print Item.Parent
End If
End Sub
...返回此信息。
收件箱
RE:测试
我希望得到“测试”,这是被回复的电子邮件,因此它可以自动移动。移动(d)到存档文件夹。
答案 0 :(得分:2)
我认为这在Outlook 2010中会更好。对于早期版本,我相信您希望此代码直接引自http://www.outlookcode.com/codedetail.aspx?id=1714
Function FindParentMessage(msg As Outlook.MailItem) _
As Outlook.MailItem
Dim strFind As String
Dim strIndex As String
Dim fld As Outlook.MAPIFolder
Dim itms As Outlook.Items
Dim itm As Outlook.MailItem
On Error Resume Next
strIndex = Left(msg.ConversationIndex, _
Len(msg.ConversationIndex) - 10)
Set fld = Application.Session.GetDefaultFolder(olFolderInbox)
strFind = "[ConversationTopic] = " & _
Chr(34) & msg.ConversationTopic & Chr(34)
Set itms = fld.Items.Restrict(strFind)
Debug.Print itms.Count
For Each itm In itms
If itm.ConversationIndex = strIndex Then
Debug.Print itm.To
Set FindParentMessage = itm
Exit For
End If
Next
Set fld = Nothing
Set itms = Nothing
Set itm = Nothing
End Function
答案 1 :(得分:2)
Item.ConversationTopic
是您正在寻找的财产。