|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 cumulonimbus 于 2013-2-27 18:40 编辑
[code=vb]
Sub kkk()
myday = Split(Now(), " ")(0)
mystr = ReadOut(ThisWorkbook.Path & "\post_test.txt")
mystr = Replace(mystr, "contaminationday", myday)
With CreateObject("Msxml2.XMLHTTP.6.0")
For m = 1 To 2
mystr1 = Replace(mystr, "cumulonimbus", m)
.Open "POST", "http://www.gzgcjg.com/gzqypjtx/Estimate/ZY/MainQueryMarkZY.aspx?clearPaging=true", False
.setRequestHeader "Referer", "http://www.gzgcjg.com/gzqypjtx/Estimate/ZY/MainQueryMarkZY.aspx?clearPaging=true"
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.Send mystr1
Set oDoc = CreateObject("htmlfile")
oDoc.body.innerHTML = .responsetext
k = [a65536].End(xlUp).Row + 1
Set r = oDoc.All.tags("td")
For i = 1 To 191 Step 10
For j = 1 To 10
Cells(k, j) = r(i - 1 + j).innerText
Next j
k = k + 1
Next i
Next m
End With
End Sub
Private Function ReadOut(FullPath)
On Error Resume Next
Dim Fso, FileText
Set Fso = CreateObject("scRiPTinG.fiLEsysTeMoBjEcT")
Set FileText = Fso.OpenTextFile(FullPath, 1, True)
ReadOut = FileText.ReadAll
FileText.Close
End Function
[/code]
这是我的解法。
|
|