I'm trying to use (2007) Excel VBA to open Internet Explorer, navigate to google.com, enter the text string from an Excel spreadsheet into the google.com search form, and then click the "Google Search" button.
The code I'm using opens Internet Explorer, navigates to google.com, and nicely inputs the Excel text string into the Google search form. But I can't seem to get my code to click the "Google Search" button. Any suggestions?
Here's the code I've got:
Sub FillInternetForm()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "http://www.google.com"
IE.Visible = True
While IE.Busy
DoEvents
Wend
IE.document.all("q").Value = ThisWorkbook.Sheets("Sheet1").Range("A1")
IE.document.all("btnK").Click
End Sub