Solved

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

Posted on 2003-10-28
12
333 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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
 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 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