JumboCactuar
Well-known Member
- Joined
- Nov 16, 2016
- Messages
- 788
- Office Version
- 365
- Platform
- Windows
Hi,
i found this vba script which works super fast, however it only works if there is only 1 table on the website.
Now im looking for something similar which works for specific tables, i.e when you "get data from web" and it displays table 0, table 1 etc....
Does anyone know of a way? get data from web is pretty slow as it works differently to the above i think
Appreciate any help
i found this vba script which works super fast, however it only works if there is only 1 table on the website.
Code:
Sub test()
Dim oDom As Object: Set oDom = CreateObject("htmlFile")
Dim x As Long, y As Long
Dim oRow As Object, oCell As Object
Dim data
y = 1: x = 1
With CreateObject("msxml2.xmlhttp")
.Open "GET", "https://ffrk.kongbakpao.com/character-usable-abilities/", False
.Send
oDom.body.innerHtml = .responseText
End With
With oDom.getelementsbytagname("table")(0)
ReDim data(1 To .Rows.Length, 1 To .Rows(1).Cells.Length)
For Each oRow In .Rows
For Each oCell In oRow.Cells
data(x, y) = oCell.innerText
y = y + 1
Next oCell
y = 1
x = x + 1
Next oRow
End With
Sheets(1).Cells(1, 1).Resize(UBound(data), UBound(data, 2)).Value = data
End Sub
Now im looking for something similar which works for specific tables, i.e when you "get data from web" and it displays table 0, table 1 etc....
Does anyone know of a way? get data from web is pretty slow as it works differently to the above i think
Appreciate any help