Chciałbym wyciągnąć dane z tabelki pod Geography oraz Sector a następnie wgrać je do arkusza w Excelu.
Za pomocą załączonego kodu udało mi się wyciągnąć dane z tabelki "Holdings" (niepotrzebne) oraz nagłówki w "Exposure Breakdowns". Dlaczego ten kod nie widzi danych, które mnie interesują?
Strona:
Środowisko VBA:
Sub BrowseBreakdownsWithQueryStringAndXML() Dim XMLPage As New MSXML2.XMLHTTP60 Dim HTMLDoc As New MSHTML.HTMLDocument Dim HTMLTables As MSHTML.IHTMLElementCollection XMLPage.Open "get", "https://www.blackrock.com/uk/individual/products/284262/acs-world-ex-uk-equity-tracker-fund-class-x1-acc", False XMLPage.send HTMLDoc.body.innerHTML = XMLPage.responseText ProcessHTMLPage HTMLDoc End Sub Sub ProcessHTMLPage(HTMLPage As MSHTML.HTMLDocument) Dim HTMLTables As MSHTML.IHTMLElementCollection Dim HTMLTable As MSHTML.IHTMLElement Dim HTMLRow As MSHTML.IHTMLElement Dim HTMLCell As MSHTML.IHTMLElement Set HTMLTables = HTMLPage.getElementsByClassName("fund-component fund-component-parent ppv3") For Each HTMLTable In HTMLTables For Each HTMLRow In HTMLTable.getElementsByTagName("tr") 'For Each HTMLCell In HTMLRow.getElementsByTagName("td") For Each HTMLCell In HTMLRow.Children 'includes all Tags under "tr" Debug.Print vbTab & HTMLCell.innerText Next HTMLCell Next HTMLRow Next HTMLTable End Sub