Created
July 4, 2016 16:27
-
-
Save erajanraja24/93827d760947d8aeb1b6177c0128a156 to your computer and use it in GitHub Desktop.
Automating Internet explorer with Excel VBA Part 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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