gpt4 book ai didi

vba - Gmail 就像 Outlook 中的 "Send and Archive"。回复时如何到达 "parent"邮箱

转载 作者:行者123 更新时间:2023-12-04 12:58:04 26 4
gpt4 key购买 nike

使用此代码回复主题行为“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

...返回这个。

Inbox
RE: test

我正在寻找“测试”,这是正在回复的电子邮件,因此它可以自动 .Move(d) 到存档文件夹。

最佳答案

我认为这在 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

关于vba - Gmail 就像 Outlook 中的 "Send and Archive"。回复时如何到达 "parent"邮箱,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2330669/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com