I have searched for a solution to this, but no luck. I know it will be code based, but I'm really not sure where to start with it.
Here is the problem: Input: 1 zip file containing multiple (upwards of 50) separate "Outlook Items" Each outlook item opens up into an email that has an attachment on it. Output: 1 file with all attachments from the Outlook items inside of it.
Example: input: Myzip.zip ->
Mail_item1.msg
Mail_item2.msg
Mail_item3.msg
output: MyOutputFile ->
mail_item1_attachment.pdf
mail_item2_attachment.pdf
mail_item3_attachment.pdf
any guidance is appreciated. My only thoughts thus far are outlook VBA (can this access multiple .msg items in a folder on the C drive?)
Here is what I have so far:
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