I am getting Run-time error 438: Object Doesnot support this propoerty or method
in the xNamedNodeMap.setNamedItem (myNode)
line of the following code:
Sub appendChild()
Dim xDoc As MSXML2.DOMDocument60
Set xDoc = New MSXML2.DOMDocument60
xDoc.LoadXML ("<root><child/></root>")
Dim myNode As MSXML2.IXMLDOMNode
Set myNode = xDoc.createNode(2, "Sci-Fi", "")
Dim xNamedNodeMap As MSXML2.IXMLDOMNamedNodeMap
Set xNamedNodeMap = xDoc.DocumentElement.ChildNodes.Item(0).Attributes
xNamedNodeMap.setNamedItem (myNode)
Debug.Print xDoc.XML
End Sub
Can someone help me to debug the issue?