Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata


  • 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 = ""
   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
            objMail.UnRead = False
		 End If
      End If
''''Download Scanner Images''''
End If
End Sub


  • No labels