Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Argument not optional Error, can't figure out why

Status
Not open for further replies.

vbajay

Technical User
Jan 30, 2016
1
0
0
US
I'm trying to create a list of all nodes from XML file. I created the functions below , I get an "argument not optional" error. This occurs when the node haschild node then calls the function again. Any ideas?

Thank you

Sub CreateList()
xmlExportDoc = "E:\Software Developement\SystemConfig.xml"

Dim xmldoc As MSXML2.DOMDocument
Dim xmlNodelist As MSXML2.IXMLDOMNodeList


Set xmldoc = New MSXML2.DOMDocument
xmldoc.async = False
xmldoc.Load (xmlExportDoc)
Set xmlNodelist = xmldoc.SelectNodes("/SystemConfig/Nodes/Node")
On Error Resume Next
ListNodes xmlNodelist
Set xmldoc = Nothing
Debug.Print "DONE!"
End Sub

Sub ListNodes(ByVal Nodes As MSXML2.IXMLDOMNodeList)
Dim xNode As MSXML2.IXMLDOMNode

For Each xNode In Nodes
Debug.Print xNode.Attributes(0).Text
If xNode.HasChildNodes Then

ListNodes (xNode.ChildNodes)
End If
Next xNode


End Sub
 
Use either:
[pre]Call ListNodes(xNode.ChildNodes)[/pre]
or:
[pre]ListNodes xNode.ChildNodes[/pre]

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top