title: Getting an MSXML 80070057 "incorrect parameter" error in VBS script
body: <p>Everything in this little VBS script works right up until I reach the last line of code indicated below. Upon reaching that line the script throws the error "incorrect parameter 80070057.</p>
  
  <p>After spending a great deal of time googling it turns out that the error code means roughly the same thing, incorrect parameter.</p>
  
  <pre><code>'section 15
  Set lots = xmlDoc3.selectNodes("ArrayOfLot/Lot")
  
  For Each lot in lots
      Dim nl: Set nl = lot.cloneNode(true)
      xmlDoc4.documentElement.appendChild nl
  Next
  
  xmlDoc4.save xmlDoc4.url 'this code works
  
  '**************************************************************************
  'section 16 
  Set lots = xmlDoc5.selectNodes("ArrayOfLot/Lot")
  
  For Each lot in lots
      Dim nll: Set nll = lot.cloneNode(true)
      xmlDoc6.documentElement.appendChild nll
  Next
  
  xmlDoc6.save xmlDoc6.url 'this does not work - error thrown
  </code></pre>
  
  <p>It is really frustrating because the .save works just 8 lines above that. Does anyone have any insight to what my problem may be and how I can solve it?</p>
  
  <p>Based on the answer below I am posting the code where all of the document information gets declared:</p>
  
  <pre><code>Dim xmlFilePath6: xmlFilePath6 = "section16.xml"
  Dim xmlDoc6: set xmlDoc6 = CreateObject("MSXML2.DomDocument")
  xmlDoc6.async = "false"
  xmlDoc6.load xmlFilePath6
  </code></pre>
  
  <p>This actually gets done for 6 different documents, subbing the 6 for one of the other digits 1-8. I'm still puzzled because section16.xml exists and no error is thrown on load.</p>