I'm having trouble putting together a VBA program that does a google search. I can not understand the HTML part.
The idea is to identify the open internet explorer, go to the google page and search for the word "test" in the search.
Follow the code below:
Dim ie As SHDocVw.InternetExplorer
Dim objShell As Object
Dim objWindow As Object
Dim objItem As Object
Dim objCollection As Object
Sub teste()
Set objShell = CreateObject("Shell.Application")
Set objWindow = objShell.Windows()
For Each objItem In objWindow
If LCase(objItem.FullName Like "*Internet Explorer*") Then
Set ie = objItem
End If
Next objItem
ie.navigate ("https://www.google.com.br/?gfe_rd=cr&ei=-s-bVf3ZBcf5gASo1oHAAw&gws_rd=ssl")
Do While ie.Busy Or ie.readyState <> 4
DoEvents
Loop '** Wait til page loaded
Set objCollection = ie.document.getElementsByTagName("input")
i = 0
Do While i < objCollection.all.Length
If objCollection.all(i).ID = "q" Then
objCollection.all(i).Value = "teste"
Exit Do
End If
i = i + 1
Loop
End Sub