Web scrapping - how to crawl url from websites using vba

Web scrapping - how to crawl url from websites using vba

Sub href_web()
    Dim ie As New InternetExplorer
    Dim htm As HTMLDocument
    
    ie.Visible = True
    ie.Navigate "https://quotes.toscrape.com/"
    
    Do While ie.ReadyState <> READYSTATE_COMPLETE Or ie.Busy = True: Loop
    Application.Wait Now() + TimeValue("00:00:03")
    
    Set htm = ie.Document
    
    For i = 0 To htm.getElementsByTagName("a").Length - 1
        Range("A1").Offset(i, 0).Value = htm.getElementsByTagName("a")(i).href
    Next i
    
    ie.Quit
    
End Sub

Subscribe my Channel

Akash Vishwakarma

Hi This is Akash Vishwakarma. I am working as software developer. I have knowledge in VBA, SQL Server, Python. I have developed this website from Django Framework for given traning.