Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save erajanraja24/93827d760947d8aeb1b6177c0128a156 to your computer and use it in GitHub Desktop.
Save erajanraja24/93827d760947d8aeb1b6177c0128a156 to your computer and use it in GitHub Desktop.
Automating Internet explorer with Excel VBA Part 2
Sub iepart2()
Dim ie As Object
'
Set ie = CreateObject("internetexplorer.application")
With ie
.Visible = True
.navigate "https://www.google.co.in"
Do While .busy
DoEvents
Loop
Do While .readystate <> 4
DoEvents
Loop
Set searchtxt = .document.getelementbyid("q")
searchtxt.Value = "Amarindaz"
.document.forms(0).submit
Do While .busy
DoEvents
Loop
Do While .readystate <> 4
DoEvents
Loop
Set searchres = .document.getelementbyid("resultStats")
ThisWorkbook.Sheets(1).Range("A1") = searchres.innertext
.Quit
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment