The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.