Private Sub Create_XML()
Dim objDom As DOMDocument
Dim objRootElem As IXMLDOMElement
Dim objMemberElem As IXMLDOMElement
Dim objMemberRel As IXMLDOMAttribute
Dim objMemberName As IXMLDOMElement
Set objDom = New DOMDocument
' Creates root element
Set objRootElem = objDom.createElement("Family")
objDom.appendChild objRootElem
' Creates Member element
Set objMemberElem = objDom.createElement("Member")
objRootElem.appendChild objMemberElem
' Creates Attribute to the Member Element
Set objMemberRel = objDom.createAttribute("Relationship")
objMemberRel.nodeValue = "Father"
objMemberElem.setAttributeNode objMemberRel
' Create element under Member element, and
' gives value "some guy"
Set objMemberName = objDom.createElement("Name")
objMemberElem.appendChild objMemberName
objMemberName.Text = "Some Guy"
' Saves XML data to disk.
objDom.save ("c:\temp\andrew.xml")
End Sub