Link to home
Start Free TrialLog in
Avatar of rjef
rjefFlag for United States of America

asked on

Google Seach Box via vb6 ie control

why doesn't this work.? see attachment

Option Explicit
 Dim WithEvents IE As InternetExplorer


 Private Sub Form_Load()
 Set IE = New InternetExplorer
 IE.Visible = True
 IE.Navigate2 "www.google.com"
 MsgBox ""
 IE.document.getElementById("q").Value = "TEST"
 
 End Sub
Google-Seach-Box-via-vb-ie-control.jpg
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

to search for test this is what you need..

you need to tell google that you want to search and add what you want to search for
https://www.google.com/search?q=test
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The search terms input has the name "q", but not the id.

<input name="q" ...

Open in new window


So you'd have to find a different way to obtain a reference to that element, because this won't.

IE.document.getElementById("q").Value = "TEST"

Open in new window

Avatar of rjef

ASKER

thanks
You’re welcome and I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange Most Valuable Expert (MVE) 2015, 2017
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2018
              Experts Exchange Top Expert VBA 2018
              Experts Exchange Distinguished Expert in Excel 2018