码迷,mamicode.com
首页 > 其他好文 > 详细

上市公司公告查询

时间:2015-06-10 17:29:30      阅读:470      评论:0      收藏:0      [点我收藏+]

标签:excel   vba   json   javascript   

Sub 上市公司公告查询()
    With CreateObject("WinHttp.WinHttpRequest.5.1")
        .Open "GET", "http://www.cninfo.com.cn/disclosure/fulltext/stocks/fulltext1y/cninfo/002106.js", False
        .send
        s = BytesToBstr(.responseBody, "GB2312")
        With CreateObject("scriptcontrol")
            .Language = "jscript"
            .addcode s
            For i = 0 To .Eval("szzbAffiches.length") - 1
                Cells(i + 1, 1) = "http://www.cninfo.com.cn/" & .Eval("szzbAffiches[" & i & "][1]")
                Cells(i + 1, 2) = .Eval("szzbAffiches[" & i & "][2]")
                Cells(i + 1, 3) = .Eval("szzbAffiches[" & i & "][5]")
            Next i
        End With
    End With
    Cells.Columns.AutoFit
End Sub

Function BytesToBstr(strBody, CodeBase)
    Dim objStream
    Set objStream = CreateObject("Adodb.Stream")
    With objStream
        .Type = 1
        .Mode = 3
        .Open
        .Write strBody
        .Position = 0
        .Type = 2
        .charSet = CodeBase
        BytesToBstr = .ReadText
    End With
    objStream.Close
    Set objStream = Nothing
End Function

上市公司公告查询

标签:excel   vba   json   javascript   

原文地址:http://blog.csdn.net/a814153a/article/details/46442687

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!