title: VBA Word 2010 Paste Error / No Wait Command
body: <p>I have a project that takes several documents as inputs, does some processing on them, and creates several new documents at the end. I am currently running into problems with pasting content from one Word document into another. The following code snippet seemed relevant:</p>
  
  <pre><code>Set refOrigin = FindReference(OriginDoc)
  Set refDest = PasteDoc.Range(PasteDoc.Content.Start, PasteDoc.Content.End)
  refDest.Collapse wdCollapseEnd
  refOrigin.Copy
  refDest.Paste
  </code></pre>
  
  <p>When running this code, I will <em>occasionally</em> get Run-time error 4198, <code>Command Failed</code> at the paste line in the code. However, when I go into the debugger, I can see that both refDest and refOrigin are valid ranges. Furthermore, when I step through the code line-by-line, it works. However, I can tell that in the instance where it failed, it inserted an embedded Word document already. </p>
  
  <p>I've done some research on the issues and I believe that there is some type of problem of the code running to fast for the clipboard to keep up with it sometimes. This makes sense to me because when I run the macro from a document on a network drive, it runs without a hitch. </p>
  
  <p>I thought that I would be able to simply add a wait command with <code>Application.Wait</code>, but it turns out that Word 2010 doesn't support this command; it's only in Excel. </p>
  
  <p>Does anyone have ideas as to the root of this problem, possible solutions, or any way to give Word 2010 a wait command? Thanks. </p>