|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 duquancai 于 2018-8-19 22:57 编辑
Kil1 发表于 2018-8-19 20:25
取2页、3页均可,要个方法! - Sub main()
- Dim xmlHttp As Object, DOM As Object, strText$, p&, arrData(1 To 70000, 1 To 16), i&, j&, n&
- Set xmlHttp = CreateObject("msxml2.xmlhttp")
- Set DOM = CreateObject("htmlfile")
- For p = 1 To 3 '只搞第3页,共60条数据,别抓多了,够意思就行了!
- With xmlHttp
- .Open "POST", "http://szsbzx.jsszhrss.gov.cn:9900/web/website/pubQuery/pubQueryAction?frameControlSubmitFunction=getPagesAjax", False
- .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- .send "querytype=ypml&pageIndex=" & p & "&pageCount=20&sfzf=1"
- strText = .responsetext
- End With
- With DOM
- .body.innerhtml = strText
- For i = IIf(p = 1, 0, 1) To .all.tags("table")(1).Rows.Length - 1
- n = n + 1
- For j = 0 To .all.tags("table")(1).Rows(i).Cells.Length - 1
- arrData(n, j + 1) = Split(.all.tags("table")(1).Rows(i).Cells(j).innerText, "<\/td>")(0)
- Next
- Next
- End With
- Next
- Cells.Clear
- Range("a1").Resize(n, 16) = arrData
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|