|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub PL3()
Dim objXML As Object
Set reg = CreateObject("VBScript.RegExp")
myStr = "http://www.pinble.com/LotteryOneList.aspx?type=3332858CC6D0DB930D85469DC90329E2&class=%E5%85%A8%E5%9B%BD%E4%BD%93%E5%BD%A9&lx=pls&name=%E6%8E%92%E5%88%97%E4%B8%89"
Set objXML = CreateObject("WinHttp.WinHttpRequest.5.1")
With objXML
.Open "POST", myStr, False
.setrequestheader "Host", "www.pinble.com"
.setrequestheader "Referer", "http://www.pinble.com/Lottery.htm"
.send
txtContent = .responseText
End With
With reg
.Global = True
.Pattern = " \d{4}-\d{2}-\d{2}"
Set 日期 = .Execute(txtContent)
.Pattern = " \d{7}"
Set 期号 = .Execute(txtContent)
.Pattern = "\d{3}</span>"
Set 开奖号 = .Execute(txtContent)
t = 日期.Count
End With
Cells(1, 1) = "日期"
Cells(1, 2) = "期号"
Cells(1, 3) = "开奖号"
For i = 0 To t - 1
Cells(i + 2, 1) = 日期(i)
Cells(i + 2, 2) = 期号(i)
Cells(i + 2, 3) = Replace(开奖号(i), "</span>", "")
Next i
Set objXML = Nothing
Set reg = Nothing
End Sub
用正则表达式 |
评分
-
1
查看全部评分
-
|