Solved

Automate w/o SendKeys

Posted on 2011-03-20
2
264 Views
Last Modified: 2012-06-27
So I'm learning that sendKeys is not the best idea when trying to automate a web page.  I'm finding many resources for VB.net, but not so much for VB6.

So, Can someone help me figure out how to open www.google.com in webbrowser1, type "Hello World" in the search box and hit submit?
0
Comment
Question by:hrolsons
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 35176259
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 35186659
Create a New Project (Project1)
Add a Form (Form1)
Add a WebBrowser (WebBrowser1) (You will have to add a reference in Components to "Microsoft InternetControls")

Place the code below to the form by double clicking on the form

Maximize the form to full screen (as far as possible) then stretch the Browser to fill the Form.

Run the Project.

Hope that is what you are after.  :-)
Option Explicit

Private bFirstPage As Boolean

Private Sub Form_Load()
    bFirstPage = True
    WebBrowser1.Navigate2 "www.google.com"
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
  If bFirstPage Then
    bFirstPage = False
    WebBrowser1.Document.All.Item("q").Value = "Hello World"
    WebBrowser1.Document.All("btnG").Click
  End If
End Sub

Open in new window

0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question