Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Automate w/o SendKeys

Posted on 2011-03-20
2
Medium Priority
?
267 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

609 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