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

时间:2013-10-11 13:14:05

标签: 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.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

0 个答案:

没有答案