1

我一直在寻找解决方案,但没有运气。我知道它将是基于代码的,但我真的不确定从哪里开始。

问题出在: 输入:1 个包含多个(超过 50 个)单独的“Outlook 项目”的 zip 文件 每个 Outlook 项目都会打开一个带有附件的电子邮件。输出:1 个文件,其中包含来自 Outlook 项目的所有附件。

示例:输入:Myzip.zip ->

Mail_item1.msg

Mail_item2.msg

Mail_item3.msg

输出:我的输出文件->

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
4

0 回答 0