title: VBA attach pdf based on subject line
body: <h2>Update##</h2>
  
  <p>This is what i have got from the suggestions so far. Im lost as all hell...</p>
  
  <pre><code>Sub Attach()
      Set objOutlookMgs = Application.ActiveInspector.CurrentItem
      Dim Subject As String
      Subject = Dir("H:\Contracts\Alphabetical\")
      Do While Len(Subject) &gt; 0
          Attachments.Add Subject
          Subject = Dir
      Loop
  End Sub
  </code></pre>
  
  <h2>Original Post</h2>
  
  <p>At my work we have contracts saved as pdf's. We send these to people in a stock email template in which the only thing that changes is the subject line and the attachment. The subject line is the same as the file name I am looking to attach.</p>
  
  <p>I would like to create a macro for outlook that uses the subject line to find and attach the file stored in a shared drive.</p>
  
  <p>The file path is H:\Contracts\Alphabetical\x
  x signifies letters a-z which are sub folders which contain the files stored based on the first letter of the subject line.</p>
  
  <p>I have a template we use that has a fixed body. I would like to be able to run the macro once i have entered the subject line in the template.
  The Subject line follows this format</p>
  
  <p>"Account - ref - DATE"</p>
  
  <p>Format would be something like CompanyName - 12345675 - 23OCT2014. </p>
  
  <p>Is there a way of having the macro search for a file with that name and attach it automatically. 
  I can work my way through attaching a set file each time but searching for one i have no idea about.</p>