title: Save outlook attachments and rename/append files with identifier from subject line
body: <p>Im really new to VBA and need some help. I'm trying to write a VBA script (along with a Outlook rule) to automatically download attachments from daily emails and append the file names with the date that appears in the subject. </p>
  
  <p>This is what the subject line looks like - "Email Alert for Department for 10/20/2014". I just need to isolate the rightmost 10 spaces that indicates the run date of the files. </p>
  
  <p>So I found code online that works to automatically download the attachments and append by current date which does work.  See below.</p>
  
  <pre><code>Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
  Dim objAtt As Outlook.Attachment
  Dim saveFolder As String
  Dim dateFormat
  dateFormat = Format(Now, "yyyymmdd ")
  saveFolder = "Z:\Daily Emails"
  For Each objAtt In itm.Attachments
  objAtt.SaveAsFile saveFolder &amp; "\" &amp; dateFormat &amp; objAtt.DisplayName
  Set objAtt = Nothing
  Next
  End Sub
  </code></pre>
  
  <p>I also found online that something like this should point to the date (formatted like XX/XX/XXXX and always at the end of the subject line. 
  Subject = Right(itm.Subject, 10) but im having trouble incorporating it into the code above. </p>
  
  <p>Can anyone help me? It would mean a lot </p>
  
  <p>Thanks!</p>
  
  <p>-Christina</p>