<table style="table-layout:fixed"><tr><td><div id="blog_text" class="cnt"><a href="http://pickup.mofile.com/55555555555">http://pickup.mofile.com/55555555555</a></div></td></tr></table> 我要截取http://pickup.mofile.com/55555555555,虽然有两个但是必须截取第一个 
我用 
s1 = Split(s, "<table style=""table-layout:fixed""><tr><td><div id=""blog_text"" class=""cnt""><a href = ") 'strong 前面的数据" 
s2 = Split(s1(1), ">http://pickup.mofile.com") 
Text1.Text = s2(0) 
这样截取不了,该怎么截取
注意第一行最后的a然后换行了

解决方案 »

  1.   

    如果用 WebBrowser 打开的网页,用下面的方法可以取得所有链接的引用,你可以根据实际情况直接确定需要的是第几个。
    Private Sub Command1_Click()
        Dim tags As Object
        Dim i As Long
        
        Set tags = WebBrowser1.Document.All.tags("a")
        For i = 0 To tags.length - 1
            Debug.Print tags(i).href
        Next
    End Sub
      

  2.   

    Private Sub Form_Load()
    s = "<table style=""" & "table-layout:fixed""" & "> <tr> <td> <div id=""" & "blog_text""" & " class=""" & "cnt""" & "> <a href=""" & "http://pickup.mofile.com/55555555555""" & ">http://pickup.mofile.com/55555555555 </a> </div> </td> </tr> </table>"
    p = InStr(s, "http://")
    p1 = InStr(p, s, ">")
    s1 = Mid(s, p, p1 - p)
    Debug.Print s1
    End Sub
      

  3.   

    第一 不用WebBrowser
    第二 "http://pickup.mofile.com/55555555555""" & ">http://pickup.mofile.com/55555555555 </a> </div> </td> </tr> </table>"
    这里的http://pickup.mofile.com/55555555555将来是可变的,所以不能这么写,一定要以
    <table style="table-layout:fixed"> <tr> <td> <div id="blog_text" class="cnt"> <a 开头的
    以">http://pickup.mofile.com结束的,因为将来后面的555555555是可变的,一定要截取着这一段
    因为将来我要
    s = HtmlStr("http://hi.baidu.com/**************************.html")
    s1 = Split(s, "<table style=""table-layout:fixed""><tr><td><div id=""blog_text"" class=""cnt""><a href=") 
    s2 = Split(s1(1), ">http://pickup.mofile.com")
    R = URLDownloadToFile(0, s2(0), "F:\vb\cc.txt", 0, 0)
    MsgBox "完毕"
    我要获得这个地址下载
      

  4.   

        s1 = Split(s, "<table style=""table-layout:fixed""> <tr> <td> <div id=""blog_text"" class=""cnt""> <a href=""")
        s2 = Split(s1(1), """>")
        Debug.Print s2(0)