View Full Version : Get data from XML file

11-20-2005, 05:15 AM
Is any way to get data from xml file without import the file.

this code must be:
1. search specified ID and get data ( index and RoleID number)

<Player ID="44801548" Index="1">
2. output this data to table
3. loop next ID and get also data which is this Player id section

Primary problem is how get data from xml file.

I dont want import because there are ~20 xml file and loop through all files http://vbaexpress.com/forum/images/smilies/rotlaugh.gif

11-20-2005, 09:21 AM
I would use xPath. Pseudo-code below assumes you are tracking row and columns as r,c

oXML = CreateObject("MSXML2.DOMDocument.4.0")
oXML.Async = False
;Then use

For Each objNode In oXML.SelectNodes("//*[string(@playerID) != '']")
.ActiveWorksheet.Cells(r,c).Value = objNode.Text
Next objNode