我想用VBA抓取http://www.cninfo.com.cn/information/companyinfo.html上面的数据,
想抓取 投资者关系信息->调研活动 下面每一条新闻的标题内的日期以及新闻发布的日期

解决方案 »

  1.   

    http://club.excelhome.net/thread-893760-1-1.html
      

  2.   

    版主大大,我按照那个教程试着做了一下,但是不能post提交上去不知道怎么做啊,初学不懂啊Sub test()
        Dim strRespText$, tt$, i&, DW$
        Dim URL
        URL = "http://www.cninfo.com.cn/information/companyinfo.html"
        With CreateObject("Microsoft.XMLHTTP")
            .Open "GET", URL, False
            .send
            tt = .responseText
            With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
                .SetText tt
                .PutInClipboard
            End With
            'tt = BytesToBstr(.ResponseBody, "GB2312")
            'tt = StrConv(.ResponseBody, vbUnicode,&H804)
            tt = StrConv(.ResponseBody, vbUnicode)
            With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
                .SetText tt
                .PutInClipboard
            End With
            
        End With
        
        viewstate = Split(Split(tt, "hlmname"" value=""")(1), """")(0)
        eventvalidation = Split(Split(tt, "hstockcode"" value=""")(1), """")(0)
         'MsgBox (viewstate)
        Dim Leibie
        Leibie = "tzzgxxx"
        Dim code
        code = "000001"
        
        With CreateObject("WinHttp.WinHttpRequest.5.1")
            tt = ""
                .Open "POST", URL, False
                .setRequestHeader "Referer", URL
                .setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"
                .setRequestHeader "Connection", "Keep-Alive"
                .send "hlmname=" & Leibie & "&hstockcode=" & code
                tt = .responseText
                With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
                    .SetText tt
                    .PutInClipboard
                End With
                End With
            viewstate = Split(Split(tt, "hlmname"" value=""")(1), """")(0)
            eventvalidation = Split(Split(tt, "hstockcode"" value=""")(1), """")(0)
         MsgBox (viewstate)End Sub
      

  3.   

    能帮我看看这个code么?Sub test()
        Dim strRespText$, tt$, i&, DW$
        Dim URL
        URL = "http://www.cninfo.com.cn/information/companyinfo.html"
        With CreateObject("Microsoft.XMLHTTP")
            .Open "GET", URL, False
            .send
            tt = .responseText
            With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
                .SetText tt
                .PutInClipboard
            End With
            'tt = BytesToBstr(.ResponseBody, "GB2312")
            'tt = StrConv(.ResponseBody, vbUnicode,&H804)
            tt = StrConv(.ResponseBody, vbUnicode)
            With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
                .SetText tt
                .PutInClipboard
            End With
             
        End With
         
        viewstate = Split(Split(tt, "hlmname"" value=""")(1), """")(0)
        eventvalidation = Split(Split(tt, "hstockcode"" value=""")(1), """")(0)
         'MsgBox (viewstate)
        Dim Leibie
        Leibie = "tzzgxxx"
        Dim code
        code = "000001"
         
        With CreateObject("WinHttp.WinHttpRequest.5.1")
            tt = ""
                .Open "POST", URL, False
                .setRequestHeader "Referer", URL
                .setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"
                .setRequestHeader "Connection", "Keep-Alive"
                .send "hlmname=" & Leibie & "&hstockcode=" & code
                tt = .responseText
                With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
                    .SetText tt
                    .PutInClipboard
                End With
                End With
            viewstate = Split(Split(tt, "hlmname"" value=""")(1), """")(0)
            eventvalidation = Split(Split(tt, "hstockcode"" value=""")(1), """")(0)
         MsgBox (viewstate)
     
    End Sub