Dim oXMLDoc As MSXML2.DOMDocument40
Dim oXMLNode As MSXML2.IXMLDOMNode
Dim oXMLNodeList As MSXML2.IXMLDOMNodeList
Set oXMLDoc = New MSXML2.DOMDocument40
oXMLDoc.async = False
oXMLDoc.resolveExternals = True
oXMLDoc.Load ("C:\files.xml")
oXMLDoc.setProperty "SelectionLanguage", "XPath"
Set oXMLNodeList = oXMLDoc.selectNodes("/root/file[Filename='file2.txt']")
If oXMLNodeList.length <> 1 Then
exit sub 'there is 0 or more files with same filename
else
'now I want to read all atributes to string
For Each oXMLNode In oXMLNodeList(0).selectNodes("//Atribute")
Atributes = Atributes & oXMLNode.Text & ", "
Next
end if