title: Save email attachment based on email subject
body: <p>Ever day at 12 am there is an automatic email with an excel attachment from a vendor service with a specific subject. I am using rules and code to attempt to save the attachment and insert the information into a database I have created upon being received in the inbox.</p>
  
  <p>I have tried code that I have found online however I don't know if doesn't work because of some network/ security setting my company has or if its he code it self.</p>
  
  <p>Rule:</p>
  
  <p><a href="https://i.stack.imgur.com/0JFTR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0JFTR.png" alt="enter image description here"></a></p>
  
  <p>CODE:</p>
  
  <pre><code>Public Sub CribMaster2Database(itm As Outlook.MailItem)
  Dim objAtt As Outlook.Attachment
  Dim saveFolder As String
  
  saveFolder = "c:\temp\"
      If olItem.Subject = "Test" Then
          For Each objAtt In itm.Attachments
              objAtt.SaveAsFile saveFolder &amp; "\" &amp; objAtt.DisplayName
              Set objAtt = Nothing
          Next
      End If
  
  End Sub
  </code></pre>