Set xmlDoc = CreateObject("Microsoft.XMLDOM")
Set Element = xmlDoc.createElement("人事信息") '创建元素节点
Element.setAttribute "制作人", "石兴勤" '创建或改变某个新属性
Element.appendChild (xmlDoc.createComment("这是注释"))
Set ChildName = Element.appendChild(xmlDoc.createElement("姓名")) '向节点的子节点列表的末尾添加新的子节点
ChildName.appendChild (xmlDoc.createTextNode("张三")) '创建一个文本节点
Set ChildSex = Element.appendChild(xmlDoc.createElement("性别"))
ChildSex.appendChild (xmlDoc.createTextNode("男"))
Set ChildCsny = Element.appendChild(xmlDoc.createElement("出身年月"))
ChildCsny.appendChild (xmlDoc.createTextNode("1978/10/13"))
Set ChildDate = ChildCsny.appendChild(xmlDoc.createElement("填表日期"))
ChildDate.appendChild (xmlDoc.createTextNode(Date))
Set ChildMz = Element.appendChild(xmlDoc.createElement("民族"))
ChildMz.appendChild (xmlDoc.createTextNode("汉"))
Set ChildSg = Element.appendChild(xmlDoc.createElement("身高"))
ChildSg.appendChild (xmlDoc.createTextNode(1.75))
Set Child = xmlDoc.appendChild(Element) '向xmlDoc添加新的子节点
debug.Print xmlDoc.xml
Set xmlDoc = Nothing