Sub DeleteNode()
Dim oXmlDoc As DOMDocument
Dim oXmlNode As IXMLDOMNode
Dim oXmlNodes As IXMLDOMNodeList
Set oXmlDoc = New DOMDocument
oXmlDoc.async = False
oXmlDoc.Load (ThisWorkbook.Path & "\EmployeeSalesTest.xml")
Set oXmlNodes = oXmlDoc.SelectNodes("//Employee[LastName='Bullen']")
For Each oXmlNode In oXmlNodes
oXmlNode.parentnode.RemoveChild oXmlNode
Next
oXmlDoc.Save ThisWorkbook.Path & "\EmployeeSalesTest.xml"
End Sub
|