I'm trying to save attachments automatically to a local folder using Outlook 2010.
It works when I first create the rule and apply it to all inbox. It doesn't work with incoming mail (no file was saved).
I tried adding some weird code and it fired errors so the script ran.
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "C:\temp"
Dim dateFormat As String
dateFormat = Format(itm.ReceivedTime, "yyyy-mm-dd Hmm ")
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & dateFormat & objAtt.DisplayName
Next
End Sub
It seems that Outlook doesn't recognize the attachment for incoming mail. I tried adding "MsgBox MyMail.Attachments.Count" and it returned 0.