Hi,
I am attempting, in vain, to extract data, using VBA & XML, from a multi page table from the Ireland Central Bank website (Central Bank Website).
I have been successful in extracting this using IE. However, I stumbled across code to extract web page tables using XML and can see the benefits in using this method, i.e. it is quicker.
My question is, can I use the XML method to extract data from a multi page table or am I limited to automating IE to complete this.
The XML code I've used is as follows:
I'd appreciate any help here.
Thanks,
Alan
I am attempting, in vain, to extract data, using VBA & XML, from a multi page table from the Ireland Central Bank website (Central Bank Website).
I have been successful in extracting this using IE. However, I stumbled across code to extract web page tables using XML and can see the benefits in using this method, i.e. it is quicker.
My question is, can I use the XML method to extract data from a multi page table or am I limited to automating IE to complete this.
The XML code I've used is as follows:
Code:
Sub Web_Table_Option_One()
Dim xml As Object
Dim html As Object
Dim objTable As Object
Dim result As String
Dim lRow As Long
Dim lngTable As Long
Dim lngRow As Long
Dim lngCol As Long
Dim ActRw As Long
Set xml = CreateObject("MSXML2.XMLHTTP.6.0")
With xml
.Open "GET", "[URL]http://registers.centralbank.ie/FundSearchResultsPage.aspx?searchEntity=FundServiceProvider&searchType=Name&searchText=®isters=6%2c29%2c44%2c45[/URL]", False
.send
End With
result = xml.responseText
Set html = CreateObject("htmlfile")
html.body.innerHTML = result
Set objTable = html.getElementsByTagName("table")
For lngTable = 0 To objTable.Length - 1
For lngRow = 0 To objTable(lngTable).Rows.Length - 1
For lngCol = 0 To objTable(lngTable).Rows(lngRow).Cells.Length - 1
ThisWorkbook.Sheets("Sheet2").Cells(ActRw + lngRow + 1, lngCol + 1) = objTable(lngTable).Rows(lngRow).Cells(lngCol).innerText
Next lngCol
Next lngRow
ActRw = ActRw + objTable(lngTable).Rows.Length + 1
Next lngTable
End Sub
I'd appreciate any help here.
Thanks,
Alan