It depends on how complex the html structure is and how much data you want from it.
Depending on the complexity, you can get rid of regular expressions, but for complex markup, trying to parse data from html with a regular expression is like trying to eat soup with a fork.
You can use the htmFile object to turn a flat file into objects that you can interact with, for example:
Function ParseATable(url As String) As Variant Dim htm As Object, table As Object Dim data() As String, x As Long, y As Long Set htm = CreateObject("HTMLfile") With CreateObject("MSXML2.XMLHTTP") .Open "GET", url, False .send htm.body.innerhtml = .responsetext End With With htm Set table = .getelementsbytagname("table")(0) Redim data(1 To table.Rows.Length, 1 To 10) For x = 0 To table.Rows.Length - 1 For y = 0 To table.Rows(x).Cells.Length - 1 data(x + 1, y + 1) = table.Rows(x).Cells(y).InnerText Next y Next x ParseATable = data End With End Function
source share