Vba 如何一次从多个Outlook邮件项目中删除附件?

Vba 如何一次从多个Outlook邮件项目中删除附件?,vba,email-attachments,outlook-2013,Vba,Email Attachments,Outlook 2013,我一直在寻找解决这个问题的办法,但运气不好。我知道它将是基于代码的,但我真的不确定从哪里开始 问题是: 输入:1个zip文件,包含多个(最多50个)单独的Outlook项目 每个outlook项目都会打开一封包含附件的电子邮件。 输出:1个文件,其中包含Outlook项目中的所有附件 例如: 输入: Myzip.zip-> Mail_item1.msg Mail_item2.msg Mail_item3.msg 输出: MyOutputFile-> mail_item1_attachment.p

我一直在寻找解决这个问题的办法,但运气不好。我知道它将是基于代码的,但我真的不确定从哪里开始

问题是: 输入:1个zip文件,包含多个(最多50个)单独的Outlook项目 每个outlook项目都会打开一封包含附件的电子邮件。 输出:1个文件,其中包含Outlook项目中的所有附件

例如: 输入: Myzip.zip->

Mail_item1.msg

Mail_item2.msg

Mail_item3.msg

输出: MyOutputFile->

mail_item1_attachment.pdf

mail_item2_attachment.pdf

mail_item3_attachment.pdf

感谢您的指导。到目前为止,我唯一的想法是outlook VBA是否可以访问C驱动器上文件夹中的多个.msg项目

以下是我到目前为止的情况:

Sub get_attachments_from_mailItems()
Dim inPath As String
Dim outPath As String
Dim msg As MailItem
Dim doc As Attachment

'What do I dim the following as?
Dim input_folder
Dim output_folder
Dim attachments 'collection? array?

inPath = "C:\temp\input"
outPath = "C:\temp\output"

'--I need most help with the folder objects and how to create them/use them --

'Open input folder as object
'open output folder as object

For Each msg In input_folder
    'check message for attachments, then loop if there are
    For Each doc In attachments
        'Save attachment in output_folder
    Next
Next

End Sub

是的,这是可能的。1通过msg文件将zip解压缩到临时文件夹2循环3在outlook 4下载附件中打开它们。试一试,如果你被卡住了,那就把你试过的代码贴出来,我们会从那里拿走。很高兴知道,没有批处理文件或其他东西,这是可能的。我发布了我到目前为止所做的工作,我很难找到与填空相关的文档。如果您是从VBA执行此操作,则不需要批处理文件。1要从VBA打开Zip文件,请参见网页中的其他链接。2要在outlook中打开msg文件,请参见3下载附件,请参见现在您几乎拥有了所有内容。请尝试一下,然后将您尝试过的内容发回,然后我们将从那里获得它?您能否澄清第二个链接中的信息,帮助我从我的c驱动器上的文件夹中打开msg文件?下面是我现在要做的过程:将zip解压缩到C:\temp\input。运行宏。在C:\temp\output宏中有附件:在C:\temp\input中循环每个消息的消息文件,在C:\temp\output中保存附件由于您提供的一些信息和我在网上找到的一些信息,除了循环部分外,我对所有内容都有大致的指导。我怎样才能访问我的c驱动器上的一个文件夹并循环浏览其中未知数量的文件呢