|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
学习2楼
Sub pk10()
Dim arr()
On Error Resume Next
[a3:n9999] = ""
Set html = CreateObject("htmlfile")
Set ms = CreateObject("Msxml2.XMLHTTP")
n = 57
m = 3
[a3:n999].ClearContents
str1 = "http://q.jrjimg.cn/?q=cn|s|sa&c=s,ta,tm,sl,cot,cat,ape&n=hqa&o=pl,d&p="
str2 = "050"
For page = 1 To n
ur1 = str1 & page & str2
ms.Open "GET", ur1, False
ms.Send
While Not ms.readyState = 4
DoEvents
Wend
str3 = ms.ResponseText
str3 = Split(str3, "[""")
p = UBound(str3)
ReDim arr(1 To p, 1 To 14)
For i = 1 To p
str3(i) = Replace(str3(i), """", "")
str3(i) = Replace(str3(i), "]," & Chr(10), "")
str3(i) = Replace(str3(i), "]" & Chr(10) & "]};" & Chr(10), "")
str4 = Split(str3(i), ",")
q = UBound(str4)
For j = 1 To 14
arr(i, j) = str4(j)
Next
Next
Cells(m, 1).Resize(p, 14) = arr
m = m + p
Next
End Sub
|
|