已结贴
销贴[此贴子已经被作者于2017-1-15 05:10编辑过]
Option Explicit Private Sub Command1_Click() WebBrowser1.Navigate "https://www.baidu.com/s?wd=深圳混胶机" End Sub Private Sub List1_Click() Text1.Text = List1 Text2.Text = List1.ListIndex 'list1选中行行数 End Sub Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, url As Variant) List1.Clear Dim Document As Object Dim i As Long, s1 As String, s2 As String Dim s3 As String, s4 As String For i = 0 To WebBrowser1.Document.links.length - 1 s1 = WebBrowser1.Document.links(i).href s2 = WebBrowser1.Document.links(i).innertext If Len(s2) > 1 Then '没取到标题就不添加 If s2 = "百度快照" Then '如果取到的标题是 百度快照 List1.AddItem s4 & " : " & s3 '把缓存加进列表 End If s3 = s1 '缓存 s4 = s2 End If Next i End Sub