Web Search using Google

Yorkiemuncher

New member
Local time
Today, 23:44
Joined
Mar 2, 2011
Messages
6
I am trying to use google search engine by inserting a search term directly into Google input control. I am using Access 2010 and IE9.

Private webiewindow As New SHDocVw.InternetExplorer

Sub google_search(ByVal strsearchterm As String)

With webiewindow
.Navigate (google web page)
.Document.getElementById("gbqfq").Value = strsearchterm
.Visible = True
.Height = 768
.Width = 1024
.Top = 0
.Left = 156
End With

End Sub


The problem i am having is the line in red. When executed during run time it throws a runtime error -2147467259 (80004005) Automation Error and Unspecified Error.

The above code will execute normally in debugging mode so i am at a loss to why this is. It would be greatly appreciated for a fast solution.

Cheers :)
 
You need to wait for the browser to finish navigating to the page. Try this

With webiewindow
.Navigate (google web page)
do while .readystate <> 4
doevents
loop
.Document.getElementById("gbqfq").Value = strsearchterm
.Visible = True
.Height = 768
.Width = 1024
.Top = 0
.Left = 156
End With
 
Last edited:
Cheers Fuse3k those extra lines of code worked a trick! :)
 

Users who are viewing this thread

Back
Top Bottom