title: Sending Email With Attachment Through Excel VBA
body: <p>I would like to email a report through Outlook from Excel.</p>
  
  <p>I am testing this with my own and coworkers' email address. I get an "Undeliverable" <strong><code>Error</code></strong>.</p>
  
  <p>The message says the recipient cannot be reached and suggests trying to send the email later. </p>
  
  <pre><code>Sub CreateEmail()
  
  Dim OlApp As Object
  Dim OlMail As Object
  Dim ToRecipient As Variant
  Dim CcRecipient As Variant
  
  Set OlApp = CreateObject("Outlook.Application")
  Set OlMail = OlApp.createitem(olmailitem)
  
  For Each ToRecipient In Array("jon.doe@aol.com")
      OlMail.Recipients.Add ToRecipient
  Next ToRecipient
  
  For Each CcRecipient In Array("jon.doe@aol.com")
      With OlMail.Recipients.Add(CcRecipient)
          .Type = olCC
      End With
  Next CcRecipient
  
  'Fill in Subject field
  OlMail.Subject = "Open Payable Receivable"
  
  'Add the report as an attachment
  OlMail.Attachments.Add ("C:\OpenPayRecPrint2.pdf")
  
  'Send Message
  OlMail.Send
  
  End Sub
  </code></pre>