title: send outlook mail from excel vba
body: <p>I have the following code that sends outlook mail. But this will not work when outlook is closed.<br>
  <code>Sub DraftMail(emailAddr, strBody, strSub)<br>
      Dim OutApp As Object<br>
      Dim OutMail As Object<br>
      Set OutApp = GetObject(, "Outlook.Application")<br>
      If OutApp Is Nothing Then<br>
          Set OutApp = CreateObject("Outlook.Application")<br>
      End If
      Set OutMail = OutApp.CreateItem(0)</code></p>
  
  <pre><code>On Error Resume Next
  With OutMail
      .To = ""
      .CC = ""
      .BCC = emailAddr
      .Subject = strSub
      .HTMLBody = strBody
      .Send   'or use .Display
      .ReadReceiptRequested = True
  End With
  On Error GoTo 0
  
  Set OutMail = Nothing
  Set OutApp = Nothing
  </code></pre>
  
  <p><code>End Sub</code></p>
  
  <p>Can anybody help me how to make it work even when the outlook is closed?</p>