标签: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