Notes:
- To use the "Rule Wizard" to attach a Macro to a e-mail rule you must do a regedit (I don't do this since it's useless on computers I don't have Admin Priv)
- You must enable Macros before using the below options or distribute an Add-On
- Place macro inside "ThisOutlookSession" not a separate Module
Option 1:
- Can be used to filter by domain or specific sender, edit the 3 options as needed
Public WithEvents objInboxItems As Outlook.Items Private Sub Application_Startup() Set objInboxItems = Session.GetDefaultFolder(olFolderInbox).Items End Sub Private Sub objInboxItems_ItemAdd(ByVal Item As Object) Dim objMail As Outlook.MailItem Dim objAttachment As Attachment Dim strSenderAddress As String If Item.Class = olMail Then Set objMail = Item Dim Subject As String Subject = Item.Subject Dim Body As String Body = Item.Body strSenderAddress = objMail.SenderEmailAddress ''''Download Scanner Images'''' Dim strScannerSender As String Dim strFolderPath As String strScannerSender = "user@domain.com" strFolderPath = Environ("USERPROFILE") & "\Downloads\" If strSenderAddress = strScannerSender Then If objMail.Attachments.Count > 0 Then For Each objAttachment In objMail.Attachments objAttachment.SaveAsFile strFolderPath & objAttachment.FileName Next objMail.UnRead = False objMail.Delete End If End If ''''Download Scanner Images'''' End If End Sub
Sources:
https://stackoverflow.com/questions/54423698/how-to-automatically-save-attachment-from-specific-sender
https://www.datanumen.com/blogs/how-to-auto-save-all-attachments-from-senders-in-a-specific-domain-via-outlook-vba/