简体   繁体   English

Outlook VBA - 仅移动仍在收件箱中的对话中的电子邮件

[英]Outlook VBA - Move only emails from conversation that are still in inbox

I have adjusted a routine found on the internet in Outlook VBA that moves all emails from a conversation in inbox to a specific folder.我在 Outlook VBA 中调整了 Internet 上的一个例程,该例程将所有电子邮件从收件箱中的对话移动到特定文件夹。

I move my emails by getting them like:我通过让他们像这样来移动我的电子邮件:

olItem As MailItem 'Put email from conversation in olItem
DestFolder As Outlook.Folder 'Destination folder where i want to send my email
olItem.Move DestFolder

Problem is: in this conversation I have sometimes older emails that have already been moved to the destination folder earlier: they appear in my inbox because of the way conversation mode works.问题是:在此对话中,我有时会收到一些较早的电子邮件,这些电子邮件已提前移至目标文件夹:由于对话模式的工作方式,它们会出现在我的收件箱中。

If I try to move it with olItem.Move DestFolder , the code fails as the email is already in DestFolder.如果我尝试使用olItem.Move DestFolder移动它,代码将失败,因为电子邮件已经在 DestFolder 中。

How to detect if an email is already in the destination folder and move it to ONLY if it's not there already如何检测电子邮件是否已在目标文件夹中并将其移动到仅当它不存在时

Thank you in advance for your help预先感谢您的帮助

A simple method that may suffice.一个简单的方法可能就足够了。

On Error Resume Next
olItem.Move DestFolder
' Turn error bypass off once the purpose for it has been served
On Error GoTo 0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用VBA如何将Outlook 2010中的电子邮件从辅助帐户收件箱移至指定文件夹 - Using VBA how do I move emails in outlook 2010 from my secondary account inbox into specified folder 微软 Outlook 宏将收到的电子邮件从收件箱移动到特定文件夹 - microsoft outlook macro to move incoming emails from inbox to a particular folder 如何创建宏以将最旧的 20 封电子邮件从收件箱底部移动到 Outlook 中的另一个文件夹? - How do I create a macro to move the oldest 20 emails from the bottom of my inbox to another folder in outlook? 通过 VBA 将 Outlook 收件箱和个人子文件夹中的电子邮件中的数据复制到 Excel - Copy data from emails in Outlook Inbox and personal subfolders to Excel through VBA 我可以通过 VBA 修改 Outlook 中的对话 ID 以对独立的电子邮件进行分组吗? - Can I modify Conversation ID in Outlook by VBA to group independent Emails? Outlook VBA 仅代码 从一个文件夹一次自动转发 2 封电子邮件 - Outlook VBA Code Only Autoforwarding 2 emails at a time from a folder 从 Excel VBA 访问共享的 Outlook 收件箱 - Accessing shared outlook inbox from Excel VBA 如何在 MS Outlook 中使用 VBA 中的“始终在此对话中移动消息”功能? - How to use “Always Move Messages in This Conversation” feature from VBA in MS Outlook? 从 VBA 搜索 Outlook 电子邮件 - Search Outlook Emails from VBA Use Excel VBA to move an Outlook Email from Inbox to a SubFolder of Archive based on Subject Line (Outlook 365 - Microsoft Exchange) - Use Excel VBA to move an Outlook Email from Inbox to a SubFolder of Archive based on Subject Line (Outlook 365 - Microsoft Exchange)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM