0
<?xml version="1.0"?>

<Results>
<Table>
<VehicleUnitNumber>1</VehicleUnitNumber>
<VIN>1D7RB1CT3AS245917</VIN>
<OperatingRadius>Local (up to 50 miles)</OperatingRadius>
<RegistrationState>FL</RegistrationState>
<GaragedState>FL</GaragedState>
<ModelYear>2010</ModelYear>
<Make>Dodge</Make>
<Model>Ram</Model>
<VehicleTypeDesc>Private Passenger</VehicleTypeDesc>
<WeightClass>Light</WeightClass>
<CostNew>45000</CostNew>
</Table>
</Results>

Hi. I am new to vba coding and I have been trying to access the different elements in the XML using vba. I have tried out the following code unsuccessfully:

request.getElementsByTagName("VehicleUnitNumber").item(0).text

Any have tried the other solutions on Stack Overflow. Any help is appreciated.

Brian M Stafford
  • 8,483
  • 2
  • 16
  • 25
511All
  • 1
  • 1
    Post the code you have so far – Sirius_Black Aug 11 '21 at 13:46
  • You might profit from [XML Parse](https://stackoverflow.com/questions/53558110/xml-parse-vba-excel-function-trip-msxml2-domdocument/53559474#53559474) or a complete parsing example at [Obtain (attribute) names from xml](https://stackoverflow.com/questions/51887820/obtain-attribute-names-from-xml-using-vba/51919182#51919182). Another option would be to use `Application.FilterXML(xmlstring,"//VehicleUnitNumber")` where xmlstring would be a variable holding the entire xml content. @511All – T.M. Aug 15 '21 at 18:02

0 Answers0