This is my first attempt to use MSXML2.DOMDocument
within VBA, and I'm having a "huh?" moment right off the start. My document looks like this...
<Locations>
<Location ID="23456">
<Properties>
<Property ID="12345">
etc.
I want to make a report with all the Location IDs, so I:
Set locs= XDoc.SelectNodes("//Location")
For Each loc In locs
Debug.Print loc.Attributes(0).Text
Next
and I got 23456
. Yay! But of course, those attributes might move around, so let's fix that...
Debug.Print loc.getAttribute("ID").Text
That returns Object required
. Looking in the debugger, I can see that loc
has one attribute and it's name
is ID
. That seems right. I can also see that loc.getAttribute("ID") returns null. That seems wrong.
So what's going on here?