title: Object doesn't support this property or method: 'xmldoc2.importNode'
body: <p>I am trying to copy nodes from one XML document into another. </p>
  
  <p><code>Project</code> is a root element inboth documents and I want to select all <code>ItemGroup</code> elements from first document and insert them before <code>Import</code> element in the second document. Unfortunately, I get </p>
  
  <pre><code>Object doesn't support this property or method: 'xmldoc2.importNode'
  </code></pre>
  
  <p>Here is the code I am using:</p>
  
  <pre><code>Set xmldoc1 = CreateObject("Microsoft.XMLDOM")
  xmldoc1.async = false
  xmldoc1.load WScript.Arguments(0)
  
  Set xmldoc2 = CreateObject("Microsoft.XMLDOM")
  xmldoc2.async = false
  xmldoc2.load WScript.Arguments(1)
  
  Set importNode = xmldoc2.selectSingleNode("//Project/Import")
  
  Set nodes = xmldoc1.selectNodes("//Project/ItemGroup")
  For Each node In nodes
      Set newNode = xmldoc2.importNode(node, True)
      xmldoc2.insertBefore newNode, importNode
  Next
  </code></pre>
  
  <p>How should I fix the code?</p>
  
  <p>EDIT:</p>
  
  <p>Thanks to @Ekkehard.Horner, I solved the issue. Here is the updated code</p>
  
  <pre><code>Set xmldoc1 = CreateObject("Microsoft.XMLDOM")
  xmldoc1.async = false
  xmldoc1.load WScript.Arguments(0)
  
  Set xmldoc2 = CreateObject("Microsoft.XMLDOM")
  xmldoc2.async = false
  xmldoc2.load WScript.Arguments(1)
  
  Set importNode = xmldoc2.selectSingleNode("//Project/Import")
  
  Set nodes = xmldoc1.selectNodes("//Project/ItemGroup")
  For Each node In nodes
      Set newNode = node.cloneNode(true)
      xmldoc2.documentElement.insertBefore newNode, importNode
  Next
  </code></pre>