參考:
Sub A1下載資料()
ReDim A2(1 To 200000, 1 To 15): A = 0
For i = 1 To 5
Sleep 2000 + 1000 * Rnd
With CreateObject("WinHttp.WinHttpRequest.5.1")
URL = "目標網頁"
.Open "get", URL, False
.setRequestHeader "Host", "xxxxx"
.Send
Q1 = .responseText
Q1 = Replace(Q1, """", "")
Q1 = Replace(Q1, Chr(9), "")
Q1 = Replace(Q1, Chr(10), "")
Q1 = Replace(Q1, Chr(13), "")
Q1 = Replace(Q1, "=odd>", "=>")
End With
"Sheet1.[A2] = Q1
B1 = Split(Q1, "</tr><tr class=><td>")
For j = 1 To UBound(B1)
B2 = Split(B1(j), "</td>")
B3 = Split(Replace(B2(1), "<td>", ""), ",")
A2(A + 1, 1) = Replace(B2(2), "<td>", "")
A2(A + 1, 2) = Replace(B2(0), "<td>", "")
For K = 0 To 9
A2(A + 1, 3 + K) = B3(K)
Next
A = A + 1
Application.StatusBar = i
MsgBox A
With Sheet1
If .AutoFilterMode = True Then .AutoFilterMode = False
.Rows("2:600000").ClearContents
If A > 0 Then .[A2].Resize(A, 15) = A2
.Rows(1).AutoFilter "資料篩選
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
End Sub
參考:
Sub A1下載資料()
ReDim A2(1 To 200000, 1 To 15): A = 0
For i = 1 To 5
Sleep 2000 + 1000 * Rnd
With CreateObject("WinHttp.WinHttpRequest.5.1")
URL = "目標網頁"
.Open "get", URL, False
.setRequestHeader "Host", "xxxxx"
.Send
Q1 = .responseText
Q1 = Replace(Q1, """", "")
Q1 = Replace(Q1, Chr(9), "")
Q1 = Replace(Q1, Chr(10), "")
Q1 = Replace(Q1, Chr(13), "")
Q1 = Replace(Q1, "=odd>", "=>")
End With
"Sheet1.[A2] = Q1
B1 = Split(Q1, "</tr><tr class=><td>")
For j = 1 To UBound(B1)
B2 = Split(B1(j), "</td>")
B3 = Split(Replace(B2(1), "<td>", ""), ",")
A2(A + 1, 1) = Replace(B2(2), "<td>", "")
A2(A + 1, 2) = Replace(B2(0), "<td>", "")
For K = 0 To 9
A2(A + 1, 3 + K) = B3(K)
Next
A = A + 1
Next
Application.StatusBar = i
Next
MsgBox A
With Sheet1
If .AutoFilterMode = True Then .AutoFilterMode = False
.Rows("2:600000").ClearContents
If A > 0 Then .[A2].Resize(A, 15) = A2
.Rows(1).AutoFilter "資料篩選
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
End With
End Sub