![](/img/trans.png)
[英]Using VBA how do I move emails in outlook 2010 from my secondary account inbox into specified folder
[英]Outlook VBA - Move only emails from conversation that are still in inbox
我在 Outlook VBA 中调整了 Internet 上的一个例程,该例程将所有电子邮件从收件箱中的对话移动到特定文件夹。
我通过让他们像这样来移动我的电子邮件:
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
问题是:在此对话中,我有时会收到一些较早的电子邮件,这些电子邮件已提前移至目标文件夹:由于对话模式的工作方式,它们会出现在我的收件箱中。
如果我尝试使用olItem.Move DestFolder移动它,代码将失败,因为电子邮件已经在 DestFolder 中。
如何检测电子邮件是否已在目标文件夹中并将其移动到仅当它不存在时
预先感谢您的帮助
一个简单的方法可能就足够了。
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.