neodjandre
Well-known Member
- Joined
- Nov 29, 2006
- Messages
- 950
- Office Version
- 2019
- Platform
- Windows
I am trying to use this code to get the official website of each company (names in column B). However the output is always a consent URL from google. Any other ways of going about this?
Rich (BB code):
Private Sub FeelingLucky()
Dim i As Long
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = False
For i = 2 To WorksheetFunction.CountA(Range("B:B"))
IE.Navigate "http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=" & Cells(i, 2)
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Cells(i, 3) = IE.Document.Url
Next i
IE.Quit
End Sub