|
Sub 获取网页信息()
Dim cnnObject As Object, strText, j$, js As Object
t1 = Timer
Set cnnObject = CreateObject("msxml2.xmlhttp")
For I = 1 To 10
cnnObject.Open "GET", "http://218.12.43.28:2018/pub/gongshi?pageIndex=" & I, False
line4:
cnnObject.send
Do Until cnnObject.readystate = 4
DoEvents
Loop
If cnnObject.Status <> 200 Then
GoTo line4
End If
strText = cnnObject.responseText
With CreateObject("vbscript.regexp")
.Global = True
.Pattern = "<tr bgcolor=.*>\s*<td>\s*(\d*)\s*</td>\s*<td>\s*(\S*)\s*</td>\s*<td height=.*>\s*(\S*)\s*</td>\s*<td>\s*(\S*)\s*</td>\s*<td>\s*(\S*)\s*</td>\s*<td>\s*(\S*)\s*</td>\s*<td>\s*(\S*)\s*</td>\s*<td>\s*(\S*)\s*</td>\s*<td>\s*(\S*)\s*</td>\s*<td>\s*(\d*)\s*</td>\s*<td>\s*(\S*)\s*</td>\s*<td>\s*(\d*.\d{2})\s*</td>\s*<td>\s*(\d*.\d{2})\s*</td>\s*<td>\s*(\d*.\d{2})\s*</td>\s*<td>\s*(\S*)\s*</td>\s*</tr>"
Set mat = .Execute(strText)
For Each m In mat
n = n + 1
For I2 = 1 To 15
Sheets("temp").Cells(n, I2) = .Replace(m, "$" & I2)
Next
Next m
End With
Sheets("temp").Columns("A:O").AutoFit
Sheets("temp").UsedRange.Font.Size = 9
Next
t2 = Timer - t1
MsgBox ("用时" & Format(t2, "0.00") & "秒")
End Sub
|
评分
-
2
查看全部评分
-
|