如何用vba抓取网页数据

http://www.cqcp.net/game/ssc/,只要能实时提取开奖号码就行
2025-03-09 08:31:33
推荐回答(1个)
回答1:

Sub cc()

Cells.ClearContents

Set oDoc = CreateObject("htmlfile")

With CreateObject("WinHttp.WinHttpRequest.5.1")

.Open "GET",
"",
False

.Send

.WaitForResponse

oDoc.body.innerHTML = .responsetext

Set r = oDoc.All.tags("table")(7).Rows

For i = 0 To r.Length - 1

k = [a65536].End(3).Row

For j = 0 To r(i).Cells.Length - 1

Cells(k + 1, j + 1) = r(i).Cells(j).innerText

Next j

Next i

Set r = Nothing

End With

End Sub