Hi All,
I'm trying to do some automation on internet explorer.
I want to hit the search bar "amarindaz" and see the result on A1
I have done the code according this video https://www.google.hu/url?sa=t&rct=...=UU4hVjOnGFA&usg=AOvVaw1BBmESkGfuuZglH1u8wynL
using this code
Sub iepart2()
Dim ie As Object
Set ie = CreateObject("internetexplorer.application")
With ie
.Visible = True
.navigate "https://www.google.co.uk"
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.getelementbyud("resultStats")
ThisWorkbook.Sheets(1).Range("a1") = searchres.innertext
End With
End Sub
However on "Set searchtxt = .document.getelementbyid("q")" part i get error as:
Compile error:
Variable not defined
for what should i define this variable in order to make this code work?
Thank you so much for your help in Advance
I'm trying to do some automation on internet explorer.
I want to hit the search bar "amarindaz" and see the result on A1
I have done the code according this video https://www.google.hu/url?sa=t&rct=...=UU4hVjOnGFA&usg=AOvVaw1BBmESkGfuuZglH1u8wynL
using this code
Sub iepart2()
Dim ie As Object
Set ie = CreateObject("internetexplorer.application")
With ie
.Visible = True
.navigate "https://www.google.co.uk"
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.getelementbyud("resultStats")
ThisWorkbook.Sheets(1).Range("a1") = searchres.innertext
End With
End Sub
However on "Set searchtxt = .document.getelementbyid("q")" part i get error as:
Compile error:
Variable not defined
for what should i define this variable in order to make this code work?
Thank you so much for your help in Advance