' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Set olddoc = CreateObject("Microsoft.XMLDOM")
olddoc.Async = False
olddoc.Load("foo.xml")
Set newdoc = CreateObject("Microsoft.XMLDOM")
newdoc.AppendChild(newdoc.CreateElement("bar"))
For Each n in olddoc.SelectNodes("//foo/*")
    newdoc.DocumentElement.AppendChild(n.CloneNode(True))
Next
newdoc.Save("bar.xml")
Set alldoc = Nothing
Set newdoc = Nothing
