title: How to attach active Excel workbook to an email
body: <p>I have been trying all morning to get this VBA script to attach my active excel document to an auto-generated outlook message. Everything works fine if I declare the file path as a string and attach it. Except that I would like to attach the full file path of the current excel document instead of using a static string value. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>Private Sub CommandButton1_Click()
      Dim OutApp As Object
      Dim OutMail As Object
      Dim strbody As String
      Dim sAttach As String
      Dim sTo As String
      Dim sCC As String
  
  
  
      'For To field
      Set emailRng = Worksheets("Pre-Clearance Email").Range("E11:J14")
  
      For Each cl In emailRng
          sTo = sTo &amp; ";" &amp; cl.Value
      Next
  
      sTo = Mid(sTo, 2)
  
      'For CC field
      Set emailRngCC = Worksheets("Pre-Clearance Email").Range("E16:J19")
  
      For Each cl In emailRngCC
          sCC = sCC &amp; ";" &amp; cl.Value
      Next
  
      sCC = Mid(sCC, 2)
  
  
  
      Set OutApp = CreateObject("Outlook.Application")
      Set OutMail = OutApp.CreateItem(0)
  
      'variable declarations for email body and attachment
      strbody = "&lt;BODY style=font-size:11pt;font-family:Calibri&gt;Good Morning;&lt;p&gt;Please see the attached aliases for validation. Please let me know if you have any questions.&lt;p&gt;Thank you.&lt;/BODY&gt;"
      sAttach = "K:\CRM Support\Data\Systematic Trade Recon (1).xlsm"
  
      'the below code adds a users default signature to the email
      With OutMail
          .Display
      End With
          signature = OutMail.HTMLBody
  
      With OutMail
          .to = sTo
          .CC = sCC
          .Subject = "STR Pre-Clearance"
          .HTMLBody = strbody &amp; signature
          .Attachments.Add (ActiveDocument.FullName)
  
          '.Attachments.Add sAttach
          .Display 'Instead of .Display, you can use .Send to send the email _
                      or .Save to save a copy in the drafts folder
      End With 
  </code></pre>
  
  <p>The compiler gives me an error at this line:</p>
  
  <pre><code>.Attachments.Add (ActiveDocument.FullName)
  </code></pre>
  
  <p>I have done some research, and tried to fix the problem myself, but I just can't figure out how to make this script attach the active file to this outlook message. As you can see by my code, my backup option is to just use a string variable and a static address to attach the file, but I would rather make this script more versatile than that. </p>
  
  <p>Here is one of the sites which I found that gave me this idea to begin with: <a href="http://www.mrexcel.com/forum/excel-questions/711979-visual-basic-applications-attach-active-document.html" rel="nofollow">Here</a></p>