|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
liucqa 发表于 2012-7-28 15:21
请看下面的代码,原贴在这里:http://club.excelhome.net/forum.php?mod=redirect&goto=findpost&ptid=8112 ...
这是新的会计师网址,你的代码在这不管用了,呵呵
http://219.239.196.201/cicpa2_web/public/query0/1/00.shtml
Sub Test()
Dim tmp() As String, P As Long, arr() As String, xmlhttp As Object, I As Long, t As Single, COOKIE As String
Set xmlhttp = CreateObject("WinHttp.WinHttpRequest.5.1")
With xmlhttp
.Option(6) = 0
.Open "GET", "http://219.239.196.201/cicpa2_web/public/query0/1/00.shtml", False
.SEND
COOKIE = Split(.getResponseHeader("Set-Cookie"), ";")(0) '第一次调用获取Cookie
End With
With xmlhttp
.Open "POST", "http://219.239.196.201/cicpa2_web/OfficeIndexAction.do", False
.Option(6) = 1
.setRequestHeader "Referer", "http://219.239.196.201/cicpa2_web/public/query0/1/00.shtml" '设置正确的Referer
.setRequestHeader "Cookie", COOKIE '设置有效Cookie
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.setRequestHeader "Connection", "keep-alive"
.SEND "method=queryOffices&isStock=&pageNum=1&ascGuid=00000000000000000000000000000000&offName=&offCode=&cpaNum=1" '第二次获取数据
With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") 'DataObject对象,数据放入剪贴板,记事本观察数据
.SetText xmlhttp.responsetext
.PutInClipboard
End With
End With
Set xmlhttp = Nothing
End Sub
|
|