一区二区三区日韩精品-日韩经典一区二区三区-五月激情综合丁香婷婷-欧美精品中文字幕专区

分享

澳客網(wǎng)競彩數(shù)據(jù)下載 | VBA實(shí)例教程

 gblhp 2015-02-16

Option Explicit
Dim wb
Sub Macro1()
Dim winhttp, url, t, arr, i, j, arr1, n, d, dw
Application.ScreenUpdating = False
Application.DisplayStatusBar = True
Set winhttp = CreateObject("WinHttp.WinHttpRequest.5.1")
url = "http://www.okooo.com/jingcai/"
With winhttp
Application.StatusBar = "正在連接..."
.Open "GET", url, False
.setRequestHeader "Connection", "Keep-Alive"
.Send
t = BytesToBstr(.ResponseBody, "GB2312")
'    With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")       '調(diào)試用,數(shù)據(jù)放入剪貼板
'        .SetText t
'        .PutInClipboard
'    End With
End With
Set wb = Workbooks.Add
arr1 = Split(t, "<div class=""touzhu"">")
For j = 2 To UBound(arr1)
d = Date + j - 2
t = arr1(j)
arr = Split(t, "'歐']);""")
For i = 1 To UBound(arr)
On Error Resume Next
url = "http://www.okooo.com" & Split(Split(arr(i), "href=""")(1), """")(0)
dw = Split(Split(Split(arr(i), "zhum fff hui_colo")(1), "=""")(1), """>")(0) & "VS" & Split(Split(Split(arr(i), "zhum fff hui_colo")(2), "=""")(1), """>")(0)
Set wb = ActiveWorkbook
Call Macro2(url, d, dw)
Next
Next
wb.SaveAs ThisWorkbook.Path & "\" & Application.Text(d, "mm-dd") & ".xls"
wb.Close
Set winhttp = Nothing
Application.StatusBar = False
Application.ScreenUpdating = True

End Sub
Function BytesToBstr(strBody, CodeBase)                        '使用Adodb.Stream對(duì)象提取字符串
Dim objStream
On Error Resume Next
Set objStream = CreateObject("Adodb.Stream")
With objStream
.Type = 1                                                              '二進(jìn)制
.Mode = 3                                                             '讀寫
.Open
.Write strBody                                                       '二進(jìn)制數(shù)組寫入Adodb.Stream對(duì)象內(nèi)部
.Position = 0                                                         '位置起始為0
.Type = 2                                                             '字符串
.Charset = CodeBase                                            '數(shù)據(jù)的編碼格式
BytesToBstr = .ReadText                                       '得到字符串
End With
objStream.Close
Set objStream = Nothing
If Err.Number <> 0 Then BytesToBstr = ""
On Error GoTo 0
End Function
Sub Macro2(url, d, dw)
Dim winhttp, oDoc, t, i, j, r, n, p, PostData, state, page, arr2, arr, wb, sht, url1, wb1
Application.ScreenUpdating = False
Application.DisplayStatusBar = True
Set sht = ActiveWorkbook.Sheets.Add(Sheets("Sheet1"))
sht.Name = dw
sht.Cells.Clear
arr = Array("序號(hào)", "公司名", "主", "客", "平", "主", "平", "客")
sht.Range("a1").Resize(1, 8) = arr
Set winhttp = CreateObject("Microsoft.XMLHTTP")
Set oDoc = CreateObject("htmlfile")
With winhttp
On Error Resume Next
For p = 0 To 12
url1 = url & "ajax/?page=" & p & "&companytype=BaijiaBooks&type=1"
Application.StatusBar = "正在連接..."
.Open "GET", url1, False
.setRequestHeader "Connection", "Keep-Alive"
.Send
t = "<table>" & .responsetext & "</table>"

oDoc.body.innerhtml = t
Set r = oDoc.all.tags("table")(0).Rows
ReDim arr2(0 To r.Length, 0 To 7)
For i = 0 To r.Length - 1
For j = 0 To r(i).Cells.Length - 9
arr2(i, j) = r(i).Cells(j).innertext
Next j
Next i
sht.Range("a" & sht.[a65536].End(xlUp).Row + 1).Resize(UBound(arr2), 8) = arr2
Erase arr2
Next
sht.Cells.Replace What:="↑ ", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
sht.Cells.Replace What:="↓ ", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
n = sht.[a65536].End(xlUp).Row
End With
Set sht = Nothing
Set oDoc = Nothing
Set winhttp = Nothing
Application.StatusBar = False
Application.ScreenUpdating = True
End Sub

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請遵守用戶 評(píng)論公約

    類似文章 更多

    亚洲国产另类久久精品| 国产在线视频好看不卡| 亚洲一区二区精品免费| 国产精品丝袜一二三区| 91亚洲国产日韩在线| 国内外免费在线激情视频| 欧美日韩亚洲国产综合网 | 亚洲少妇一区二区三区懂色| 久久99青青精品免费| 久久精品国产亚洲av久按摩| 国产亚洲成av人在线观看| 绝望的校花花间淫事2| 熟女免费视频一区二区| 青青操成人免费在线视频| 日韩在线视频精品视频| 日本高清一区免费不卡| 91精品国自产拍老熟女露脸| 热久久这里只有精品视频| 亚洲视频在线观看免费中文字幕 | 精品视频一区二区不卡| 亚洲一区二区三区四区| 亚洲伦片免费偷拍一区| 亚洲二区欧美一区二区| 日本不卡在线视频中文国产| 久久国内午夜福利直播| 91麻豆视频国产一区二区| 国产日韩熟女中文字幕| 久久久精品区二区三区| 国产综合香蕉五月婷在线| 欧美成人黄色一级视频| 亚洲国产性生活高潮免费视频| 久久精品国产在热亚洲| 日本在线 一区 二区| 国产一级内射麻豆91| 日韩亚洲精品国产第二页| 亚洲中文字幕在线乱码av| 麻豆印象传媒在线观看| 亚洲熟女诱惑一区二区| 99热在线播放免费观看| 女厕偷窥一区二区三区在线| 国产一二三区不卡视频|