|
Option Explicit
rem 补齐了变量声明
Sub Main()
Dim strText As String, p As Integer, PostData, t
Cells.Clear
With CreateObject("MSXML2.XMLHTTP")
For p = 1 To 7
PostData = "PageIndex=" & p & "&__RequestVerificationToken=CfDJ8Oxgi0PF5dtKgteCEWR3ZKKzhWUHnMIkczUHpAA12yTUk-KolOww9ZYTIz6y8-tIfgH2yCgFH-DCVvplmsOa2aRf8VuJtozMmUX_clPPMks-XT6jl3vSufB9_l7nCiRKDdhrvCjTdqPEx7XgPW2-DTk"
.Open "POST", "http://www.77tj.org/tencent/", False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.Send (PostData)
strText = .responsetext
strText = "<table" & Split(Split(strText, "<table")(1), "</table>")(0) & "</table>"
If p = 1 Then
t = " <tr>"
t = t + vbCrLf + " <th>统计时间</th>"
t = t + vbCrLf + " <th>在线人数</th>"
t = t + vbCrLf + " <th>波动值</th>"
t = t + vbCrLf + " </tr>"
Else
strText = Replace(strText, t, "")
End If
CopyToClipbox strText
Cells(Rows.Count, 1).End(xlUp).Offset(IIf(p = 1, 0, 1), 0).Select
ActiveSheet.Paste
Next p
End With
End Sub
Sub CopyToClipbox(strText As String)
'文本拷贝到剪贴板
With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
.SetText strText
.PutInClipboard
End With
End Sub
|
|