How to get a webpage and extrapolate links

On a blank form, add the following controls

1. Listbox
2. WebBrowser Control
3. Command Button

Add a project reference to "Microsoft HTML Object Library"

Private Sub Command1_Click()
    Dim oHTMLDoc As MSHTML.HTMLDocument
    Dim oHTMLElement As MSHTML.IHTMLElement
    
    WebBrowser1.navigate "http://www.google.com/"

    Do
        DoEvents
    Loop Until WebBrowser1.readyState = READYSTATE_COMPLETE
    
    Set oHTMLDoc = WebBrowser1.document
    
    For Each oHTMLElement In oHTMLDoc.links
        List1.AddItem oHTMLElement
    Next
    
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.