Solved

How can I know if an Internet Explorer finish loading in Visual Basic?

Posted on 2003-10-28
12
323 Views
Last Modified: 2013-11-25
I know how to open an Internet Explorer using Visual Basic, however, I try to use keyboard_event to fill in some texts in the form in the homepage in Internet Explorer and submit that form, however, I do not know if the Internet Explorer finish loading. Would somebody tell me how can i know if an Internet Explorer finish loading in Visual Basic ? I want to know if Internet Explorer finish loading because I cannot fill in the textbox and submit the form until the internet explorer finsih loading.
0
Comment
Question by:mikekwok
  • 4
  • 2
  • 2
  • +3
12 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 9638740
wait for single process
0
 

Author Comment

by:mikekwok
ID: 9638752
What do u mean wait for single process ? Would you please tell me more details ?
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 9638783
0
 
LVL 14

Expert Comment

by:aelatik
ID: 9639641
Can you post the code on how you start IE. Are you using Shell object or IE object ?
0
 

Author Comment

by:mikekwok
ID: 9639676
I start my IE in VB using the following lines :

Set IE = CreateObject("InternetExplorer.Application")
    IE.Navigate "http://www.google.com"
    IE.Visible = True
    Do While IE.Busy
       DoEvents
    Loop


Would you please help me ?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:mikekwok
ID: 9639815
I think I have already answered my question by myself :

the code for me to test after internet explorer finish loading is :

Do While IE.Busy
       DoEvents
    Loop

0
 
LVL 17

Assisted Solution

by:zzzzzooc
zzzzzooc earned 25 total points
ID: 9640302
You did answer it yourself, but here's another method:

Private Sub Form_Load()
    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
    IE.Navigate "http://www.google.com"
    IE.Visible = True
    Do Until IE.ReadyState = 4
       DoEvents
    Loop
    MsgBox IE.document.body.outerhtml
End Sub


ReadyState_Complete = 4
0
 
LVL 5

Accepted Solution

by:
fantasy1001 earned 25 total points
ID: 9647702
Mike,
I think I found the way to load the text effectively into the html input box
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
  IE.Navigate "http://www.google.com"
  IE.Visible = True
 
   While IE.Busy
      DoEvents
  Wend
IE.Document.All("q").Value = "My Name" ' contains the HTML name of the object
IE.Document.All("btnG").Click ' contains the HTML name of the object
end sub
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9650901
Delete?, why?, there are a bunch of useful data to solve asker's problem!!!
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9650948
never mind. Sorry. :P
0
 

Author Comment

by:mikekwok
ID: 9926507
Public Sub click_Security_dialog(Language As String)
    On Error GoTo ErrorHandler
    If Language = "e" Then
        AppActivate "Security Information"
    ElseIf Language = "tc" Then
        AppActivate "安全性資訊"
    End If
    Dim clskey As New clsKeyboard
    Call clskey.PressKeyVK(keyReturn)
    Exit Sub
ErrorHandler:
Wait 1
Resume
End Sub

This code is for pressing dialog when internet explorer open. But it doesn't work when i try to open more than 1 internet explorer using visual basic and in these internet explorers pop up dialogs.

would some body tell me how to solve my problem ?  my program open 2 browsers and 2 pop up dialog and i need to press enter on that. it sometimes work but it sometimes doesn't work using the code above.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now