Results 1 to 1 of 1
Thread: Save email attachments to disk
2014-05-04, 19:47 #1
- Join Date
- Apr 2014
- Thanked 1 Time in 1 Post
Save email attachments to disk
I need to save attachments to disk from the Inbox for all emails with a specific word in subsject - using a outllok rule.
Because the files attached in the emails have the same name in all emails, I need to change the file saved name to, for example, the sender name or the email send date & time.
I'm using the code:
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dateFormat As String
saveFolder = "D:\Audiologista\Lucia@AM\Tee\Rules Outlook\" 'destination folder
dateFormat = Format(Now, "yyyy-mm-dd HH.mm")
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & dateFormat & "_" & objAtt.DisplayName
Set objAtt = Nothing
How can I change the name of the file to have the send email date or the email send name?