title: Save attachments to a folder and rename them
body: <p>I'm trying to get a VBA macro in Outlook that will save an email's attachment to a specific folder and add the date <em>received</em> to the file name. </p>
  
  <p>My googling has gotten me this far:</p>
  
  <pre><code>Public Sub saveAttachtoDisk (itm As Outlook.MailItem) 
      Dim objAtt As Outlook.Attachment 
      Dim saveFolder As String
      Dim dateFormat As String
      saveFolder = "C:\Temp\"
      dateFormat = Format(Now, "yyyy-mm-dd H-mm")
  
      For Each objAtt In itm.Attachments
          objAtt.SaveAsFile saveFolder &amp; "\" &amp; dateFormat &amp; objAtt.DisplayName
          Set objAtt = Nothing
      Next 
  End Sub
  </code></pre>
  
  <p>The first obvious thing is that it's applying the current time to the file name instead of the received time, but I can't seem to change it. My theory is that the Outlook.Attachment doesn't have a <code>ReceivedTime</code> and that the email itself has to be referenced.</p>
  
  <p>Secondly, this doesn't seem to work at all, ha! It worked the first day I started tinkering but after that it stopped saving files.</p>