求助大师,如何将同花顺行业指数抓取到excel上?  数据网址:    http://data.10jqka.com.cn/funds/hyzjl/
本人尝试学习了网抓,通过摸索运行代码后,在立即窗口中已经能够获得
大量数据,并且这些数据也是我所需要的。但是,如何将这些数据进行切割并存放到相应单元格上,实在没有头绪。
求助哪位大师帮助搞一下,不胜感谢!Sub Main()
    Dim strText As String
    With CreateObject("MSXML2.XMLHTTP") 'CreateObject("WinHttp.WinHttpRequest.5.1")
        .Open "GET", "http://q.10jqka.com.cn/interface/stock/thshy/zdf/desc/1/quote/quote", False
'        .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
'        .setRequestHeader "Referer", ""
        .Send
        strText = .responsetext
        Debug.Print strText
     
    
    End With
End Sub

解决方案 »

  1.   

    这个.......无非就是找一些关键的共同点,然后split或instr之类的。这个别人帮不了你的。
      

  2.   

    正则表达式速查 正则表达式举例 正则表达式学习 (4页A4纸)http://download.csdn.net/detail/zhao4zhong1/1808549仅供参考:Function RegExpN(ptn, txt, n) As String
    'Debug.Print "[" + RegExpN("[012]{8}", "mno_if22220101_and11000011_or00111100_xor10101010.txt", 1) + "]"
    '[22220101]
    'Debug.Print "[" + RegExpN("[012]{8}", "mno_if22220101_and11000011_or00111100_xor10101010.txt", 2) + "]"
    '[11000011]
    'Debug.Print "[" + RegExpN("[012]{8}", "mno_if22220101_and11000011_or00111100_xor10101010.txt", 3) + "]"
    '[00111100]
    'Debug.Print "[" + RegExpN("[012]{8}", "mno_if22220101_and11000011_or00111100_xor10101010.txt", 4) + "]"
    '[10101010]
    'Debug.Print "[" + RegExpN("[012]{8}", "mno_if22220101_and11000011_or00111100_xor10101010.txt", 5) + "]"
    '[]
    'Debug.Print "[" + RegExpN("[a-z]+(\d+)[_.]", "mno_if22220101_and11000011_or00111100_xor10101010.txt", 4) + "]"
    '[xor10101010.]
    'Debug.Print "[" + RegExpN("[a-z]+(\d+)[_.]", "mno_if22220101_and11000011_or00111100_xor10101010.txt", 4.1) + "]"
    '[10101010]
    'Debug.Print "[" + RegExpN("<abc>(.*)</abc>", "<html><ab>AB</ab><abc>ABC汉字</abc></html>", 1) + "]"
    '[<abc>ABC汉字</abc>]
    'Debug.Print "[" + RegExpN("<abc>(.*)</abc>", "<html><ab>AB</ab><abc>ABC汉字</abc></html>", 1.1) + "]"
    '[ABC汉字]
    Dim rtnstr As String
    Dim codestr As String
        rtnstr = ""
        With ScriptControl1
            ' Set script language (VBScript is the default).
            .Language = "VBScript"
            ' Set UI interaction (TRUE is the default).
            .AllowUI = True
            ' Copy the script to the control.
    '--------------------------------------------------------
    codestr = ""
    codestr = codestr + "Function RegExpTest(patrn, strng, ns)      " + vbCrLf
    codestr = codestr + "    Dim regEx, Match, Matches, RetStr, ii  " + vbCrLf
    codestr = codestr + "    Dim nn,ss                              " + vbCrLf
    codestr = codestr + "    nn=fix(ns)                             " + vbCrLf
    codestr = codestr + "    if nn=ns then                          " + vbCrLf
    codestr = codestr + "        ss=-1                              " + vbCrLf
    codestr = codestr + "    else                                   " + vbCrLf
    codestr = codestr + "        ss=(ns-nn)*10-1                    " + vbCrLf
    codestr = codestr + "    end if                                 " + vbCrLf
    codestr = codestr + "    Set regEx = New RegExp                 " + vbCrLf
    codestr = codestr + "    regEx.Pattern    = patrn               " + vbCrLf
    codestr = codestr + "    regEx.IgnoreCase = True                " + vbCrLf
    codestr = codestr + "    regEx.Global     = True                " + vbCrLf
    codestr = codestr + "    Set Matches = regEx.Execute(strng)     " + vbCrLf
    codestr = codestr + "    ii=0                                   " + vbCrLf
    codestr = codestr + "    For Each Match in Matches              " + vbCrLf
    codestr = codestr + "        ii=ii+1                            " + vbCrLf
    codestr = codestr + "        if ii=nn then                      " + vbCrLf
    codestr = codestr + "            if ss=-1 then                  " + vbCrLf
    codestr = codestr + "                RetStr=Match.Value         " + vbCrLf
    codestr = codestr + "            else                           " + vbCrLf
    codestr = codestr + "                RetStr=Match.SubMatches(ss)" + vbCrLf
    codestr = codestr + "            end if                         " + vbCrLf
    codestr = codestr + "            exit for                       " + vbCrLf
    codestr = codestr + "        end if                             " + vbCrLf
    codestr = codestr + "    Next                                   " + vbCrLf
    codestr = codestr + "    RegExpTest = RetStr                    " + vbCrLf
    codestr = codestr + "    Set regEx = Nothing                    " + vbCrLf
    codestr = codestr + "End Function                               " + vbCrLf
    '--------------------------------------------------------
            .AddCode codestr
            Dim oMod As Object
            Set oMod = .Modules(GlobalModule)
            rtnstr = oMod.Run("RegExpTest", ptn, txt, n)
            Set oMod = Nothing
        End With
        RegExpN = rtnstr
    End Function