title: Server execution failed creating Outlook Application
body: <p>I'm trying to send from a mail list using Outlook15.</p>
  <p>I wrote the following, that loops through 16 cells with mail addresses, and attaches pdf files.</p>
  <p>I get:</p>
  <blockquote>
  <p>&quot;run time error '-2146959355(80080005)':<br />
  server execution failed&quot;</p>
  </blockquote>
  <p>When I debug <code>Set outlookapp = CreateObject(&quot;Outlook.Application&quot;)</code> is highlited.</p>
  <pre class="lang-vb prettyprint-override"><code>Sub SndEmail()
  'define variables and their types'
  Dim address As String
  Dim subject As String
  Dim message As String
  Dim filename As String
  Dim outlookapp As Object
  Dim outlookmailitem As Object
  Dim myAttachments As Object
  Dim path As String
  Dim lastrow As String
  Dim attachment As String
  'x will be row index we loop through'
  Dim x As Integer
  
  x = 61
  
  Do While x &lt; 77
          
      Set outlookapp = CreateObject(&quot;Outlook.Application&quot;)
      Set outlookmailitem = outlookapp.CreateItem(0)
      Set myAttachments = outlookmailitem.Attachments
      'taking the file path from cells in excel'
      path = sheet1.Cells(x, 4)
      address = sheet1.Cells(x, 3)
      subject = &quot;hello world&quot;
      attachment = path
          
      outlookmailitem.To = address
      outlookmailitem.CC = &quot;&quot;
      outlookmailitem.BCC = &quot;&quot;
      outlookmailitem.subject = subject
      'taking the body content from cell 56'
      outlookmailitem.Body = sheet1.Cells(56, 3)
                  
      myAttachments.Add (attachment)
      outlookmailitem.Display
      outlookmailitem.Send
          
      address = &quot;&quot;
      x = x + 1
  Loop
          
  Set outlookapp = Nothing
  Set outlookmailitem = Nothing
  
  End Sub
  </code></pre>