Save Outlook attachments using VBA.

You can set up Outlook desktop using Outlook VBA to save attachments to your local folder. You may need to lower the security of Outlook to allow VBA to run.

If you receive attachments via e-mail, you might want to save them to your local folder for certain e-mail.

You create a rule where you target that incoming e-mail (e.g. From, To, Body, or Message Header contains a specific text). Then you call this script to be run. Whenever there is a match, Outlook will save that e-mail’s attachment to the folder of your choice.

Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "c:\temp\attachment"
For Each objAtt In itm.Attachments
objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
Set objAtt = Nothing
Next
End Sub

Leave a Reply

avatar
  Subscribe  
Notify of