Const FILE_NAME = "test.xml" 'Create XML object On Error Resume Next Set xml = Nothing If xml Is Nothing Then Set xml = CreateObject("Msxml2.DOMDocument.4.0") If xml Is Nothing Then Set xml = CreateObject("Msxml2.DOMDocument") If xml Is Nothing Then Set xml = CreateObject("Msxml2.XMLDocument") If xml Is Nothing Then Set xml = CreateObject("Msxml.DOMDocument") If xml Is Nothing Then Set xml = CreateObject("Microsoft.XMLDOM") On Error Goto 0 xml.async = False 'Open a file If Not xml.load(FILE_NAME) Then 'Create a new document xml.appendChild(xml.createProcessingInstruction("xml","version=""1.0""")) xml.appendChild(xml.createElement("root")) End If 'Add a node Set newElem = xml.createElement("testing") newElem.text = "something here" xml.selectSingleNode("//root").appendChild newElem 'Change a value xml.selectSingleNode("//root/testing").text = "foobar" 'Test for a node existence Set node = xml.selectSingleNode("//root/testing") If node Is Nothing Then MsgBox "Node not found" Else MsgBox "Node found" End If 'Remove a node Set node = xml.selectSingleNode("//root") node.removeChild xml.selectSingleNode("//root/testing") 'Read a value MsgBox xml.documentElement.selectSingleNode("//root").getAttribute("testing") 'Save changes xml.save FILE_NAME