Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi
Is it possible to translate my VBA code below into M or DAX so the table is created in Power BI?
Sub HL_Sectors() Dim XMLPage As New MSXML2.XMLHTTP60 Dim HTMLDoc As New MSHTML.HTMLDocument Dim HTMLSector As MSHTML.IHTMLElement Dim HTMLSectorID As MSHTML.IHTMLElement Dim RowNum As Long, ColNum As Integer XMLPage.Open "GET", "http://www.hl.co.uk/funds", False XMLPage.send HTMLDoc.body.innerHTML = XMLPage.responseText Set HTMLSector = HTMLDoc.getElementById("search-sector") Range("A:A").ClearContents RowNum = 1 For Each HTMLSectorID In HTMLSector.getElementsByTagName("option") ColNum = 1 Cells(RowNum, ColNum) = HTMLSectorID.innerText ColNum = ColNum + 1 RowNum = RowNum + 1 Next HTMLSectorID End Sub
Thanks
Hi @KM007,
As we're not very familiar with VBA, could you be more precisely with what you are trying to extract from that page? For most web pages, you should be able to use the Web connector in Power BI Desktop to extract data as mentioned by @Greg_Deckler above.
Regards
What is the information that you are trying to extract from that page? You would use the Get Data -> Web option and then you're going to just have to drill through the DOM until you find the right section.