email wait 30 secs then login

hello,
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
  DoEvents
Loop
 
'login to hotmail
oIE.Document.forms("f1").all("login").Value = "myhotmail@hotmail.com"
oIE.Document.forms("f1").all("passwd").Value = "mypassword"
oIE.Document.forms("f1").submit
 
Do Until Not oIE.Busy
  DoEvents
Loop
apleloisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonMiddle School Assistant TeacherCommented:
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"
    IE.Document.Forms("f1").submit
End Sub

Private Sub IE_OnQuit()
    Set IE = Nothing
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.