title: Clear clipboard when copying graphs in Excel VBA
body: <p>I copy and paste several Excel graphs from Excel to Powerpoint using VBA:</p>
  
  <pre><code>'copy from excel worksheet
      Workbooks(Stats &amp; ".xls").Worksheets(Stats).ChartObjects("graph4").Copy
  'paste into powerpoint presentation
      .Slides(3).Shapes.Paste
  
  ' more code and more copy and pastes
  ' ...
  </code></pre>
  
  <p>Sometimes, copying the graphs fails. I have no explanation for this other than maybe memory problems.
  The error message that I get:</p>
  
  <blockquote>
    <p>Method 'Copy' of object 'Chartobject' failed.</p>
  </blockquote>
  
  <p>Then Excel gets unresponsive and I have to restart it.</p>
  
  <p>What can I do to prevent this?
  Maybe I could clear the clipboard between the copy and paste operations?</p>
  
  <p>Update:
  I've tried the two mentioned ways to clear the clipboard. The copy &amp; paste operation still fails from time to time. The run-time error is "-2147417848 (80010108)".
  There's some info about this error on the net, so I'll start over from there.</p>
  
  <p>Update (Final):
  I think I solved the problem by putting this code in front of the parts where the charts are copy and pasted. The error has not appeared again.</p>
  
  <pre><code>DoEvents 'lets the operating system clear / execute any backed up / queued events that it might have to execute.
  'slow down the execution (to not get an error)
  Workbooks(Stats &amp; ".xls").Save
  </code></pre>