title: Run-time error -2147023170 (800706be) when copy-pasting images from Excel to Word
body: <p>I am trying to copy/paste some images from my Excel sheet to a word file. Sometimes, it works flawlessly, but often I run into the great <em>Run-time error '-2147023170 (800706be)': Automation error. The remote procedure call failed.</em> message. Google showed my that I'm not alone with this error and that it often results from the fact that e.g. ranges are not precisely defined.I think they are in my project, however.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>Dim wdDoc As Object
  Dim wdApp As Object
  Set wdApp = CreateObject("Word.Application")
  Set wdDoc = wdApp.Documents.Add
  Dim wdImg As Object
  ThisWorkbook.Worksheets("Backup - Do not change").Shapes("companyLogo").Copy
  With wdDoc.Sections(1).Headers(2).Range
      .PageSetup.DifferentFirstPageHeaderFooter = True
      .Paste
      Set wdImg = .InlineShapes(.InlineShapes.Count).ConvertToShape
      With wdImg
         'some specifications
      End With
  End With
  ThisWorkbook.Worksheets("Backup - Do not change").Shapes("projectLogo").Copy
  With wdDoc.Sections(1).Headers(2).Range
      .Paste
      Set wdImg = .InlineShapes(.InlineShapes.Count).ConvertToShape
      With wdImg
         'some specifications
      End With
  End With
  Application.CutCopyMode = False
  </code></pre>
  
  <p>The error always occurs at <code>.Paste</code>. I already tried <code>.PasteSpecial DataType:=8</code> and various other things but it didn't help. Any help is very welcome!</p>