[Webinar] Streamline your web hosting managementRegister Today


email wait 30 secs then login

Posted on 2006-04-24
Medium Priority
Last Modified: 2010-05-18
I have this code in my VB6 form, but I dont want the (Do Until Not oIE.Busy)
I want to wait 30 secs then login.. how can I do that?

Dim oIE
On Error Resume next
'first get our login page
set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True
oIE.Navigate ("http://login.passport.net/uilogin.srf?id=2")
Do Until Not oIE.Busy
'login to hotmail
oIE.Document.forms("f1").all("login").Value = "myhotmail@hotmail.com"
oIE.Document.forms("f1").all("passwd").Value = "mypassword"
Do Until Not oIE.Busy
Question by:aplelois
1 Comment
LVL 86

Accepted Solution

Mike Tomlinson earned 2000 total points
ID: 16531342
Something like...

Click on Project --> References and check the "Microsoft Internet Controls" entry.
Add a Timer control (Timer1).

Option Explicit

Private counter As Integer
Private WithEvents IE As InternetExplorer

Private Sub Form_Load()
    Timer1.Enabled = False
End Sub

Private Sub Command1_Click()
    If IE Is Nothing Then
        Set IE = CreateObject("InternetExplorer.Application")
        IE.Visible = True
    End If
    counter = 0
    IE.Navigate "http://login.passport.net/uilogin.srf?id=2"
End Sub

Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    counter = counter + 1
    Select Case counter
        Case 1
            ' login after 30 seconds...
            Timer1.Interval = 30000 ' 30 seconds
            Timer1.Enabled = True
        Case 2
            ' after login...do something else in here...
    End Select
End Sub

Private Sub Timer1_Timer()
    Timer1.Enabled = False
    counter = counter + 1
    IE.Document.Forms("f1").All("login").Value = "myhotmail@hotmail.com"
    IE.Document.Forms("f1").All("passwd").Value = "mypassword"
End Sub

Private Sub IE_OnQuit()
    Set IE = Nothing
End Sub

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 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…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

591 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