• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Web Link Scrap

How can scrap first 10 google search result url using VBA?, is this possible? I have a large list of search queries in column B. Is there any code I can use in order to extract the 10 Google search result URL in columns?
 

Attachments

  • Sample.xlsx
    9.7 KB · Views: 5
Last edited:
Hi Marc L,

Thanks for your reply, i have a VBA code for Google Search, but it creates only first result of google search, but i need

10 Google search result, Example i had attached, I ref code from https://stackoverflow.com/questions/57409710/how-to-extract-first-google-search-result-url

Is there any modification for getting 10 Search result... am waiting for your reply...

Thanks..
Jeyachandran :):)


Code:
============================================================
Code:
Option Explicit
Sub Getlink()

Dim ie As New InternetExplorer
Dim lastrow As Integer
Dim i As Integer

lastrow = Range("B" & Rows.Count).End(xlUp).Row


    For i = 3 To lastrow
        ie.Visible = False
        ie.navigate "https://www.google.com/search?q=" & Cells(i, 2)
        While ie.Busy Or ie.readyState < 4: DoEvents: Wend

       Cells(i, 3).Value = ie.document.querySelector("#search div.r [href*=http]").href

Next

End Sub
==========================================================================
 
Last edited by a moderator:
Back
Top