|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
河北理科201-2017:
Sub GetWWW()
Dim objHTML As Object, strText$, s$
Set objHTML = CreateObject("htmlfile")
Set objwindow = objHTML.parentWindow
k = 1
Cells.ClearContents
For y = 2015 To 2017
With CreateObject("msxml2.xmlhttp")
.Open "POST", "https://g.eol.cn/gaokao/school/apitopscorebyspecial", False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send "schoolid=31&province=10016&type=10035&year=" & y
strText = .responseText
End With
objwindow.execScript "a=" & Replace(strText, "var", "temp")
l = objwindow.eval("a.length")
r = Array("zyname", "max", "min", "temp")
For i = 0 To l - 1
k = k + 1
Cells(k, 1) = y
For j = 0 To UBound(r)
s = "a[" & i & "]." & r(j)
Cells(k, j + 2) = objwindow.eval(s)
Next
Next
Next
[a1:e1] = Array("年份", "专业名称", "最高分", "最低分", "平均分")
Set objwindow = Nothing
End Sub
|
评分
-
1
查看全部评分
-
|