Get Array from XML web page using VBA

nd0911

Board Regular
Joined
Jan 1, 2014
Messages
166
Hello,

I have this code:

Code:
Dim xmlOBject As Object


Set xmlOBject = CreateObject("MSXML2.DOMDocument.6.0")


xmlOBject.async = False
xmlOBject.Load ("https://www.boi.org.il/currency.xml")' just example URL

and its load to the xmlOBject variable the XML resulte.

Is there a way to convert a XML resulte (dynamically, no matter how many xml levels) to array ? ( i'm intrest by any URL, not just the URL provided above).

The above URL should provide the this array:

30/10/2019Dollar1USDUSA3.528-0.057
30/10/2019Pound1GBPGreat Britain4.54890.196
30/10/2019Yen100JPYJapan3.24150.009
30/10/2019Euro1EUREMU3.92090.194
30/10/2019Dollar1AUDAustralia2.42230.124
30/10/2019Dollar1CADCanada2.6966-0.311
30/10/2019krone1DKKDenmark0.52480.191
30/10/2019Krone1NOKNorway0.3830.578
30/10/2019Rand1ZARSouth Africa0.2414-0.041
30/10/2019Krona1SEKSweden0.36320.138
30/10/2019Franc1CHFSwitzerland3.55460.234
30/10/2019Dinar1JODJordan4.9745-0.068
30/10/2019Pound10LBPLebanon0.02340.429
30/10/2019Pound1EGPEgypt0.2182-0.411

<colgroup><col><col span="6"></colgroup><tbody>
</tbody>
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
You'd need to walk the XML, probably recursively to populate an array of jagged nested arrays.

Honestly though, why bother? XML is designed for being machine readable, queryable and you can loop through it - it offers a much richer interface with more features than jagged arrays that are a pain in Excel.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,912
Messages
6,122,204
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top