Option
Explicit
Public
Sub
readAttributeValue()
Dim
xDoc
As
New
MSXML2.DOMDocument60
If
xDoc.Load(
"C:\Users\user\Desktop\test.xml"
)
Then
Dim
xNode
As
IXMLDOMNode
Set
xNode = xDoc.SelectSingleNode(
"//GetWDVBSEvents/VBAEvents"
)
If
Not
xNode
Is
Nothing
Then
Dim
xNodeChild
As
IXMLDOMNode
For
Each
xNode
In
xNode.ChildNodes
Debug.Print xNode.Attributes.getNamedItem(
"Name"
).Text
Next
xNode
Else
MsgBox
"Node wurde in XML nicht gefunden."
, vbInformation
End
If
Else
GoTo
cleanup
End
If
cleanup:
If
Not
xDoc
Is
Nothing
Then
Set
xDoc =
Nothing
If
Not
xNode
Is
Nothing
Then
Set
xNode =
Nothing
If
Not
xNodeChild
Is
Nothing
Then
Set
xNodeChild =
Nothing
End
Sub