VB Wait...

M

MarkHear1

Hi all,

I asked in here the other day how i could get rid of :
Application.Wait Now + TimeValue("00:00:3")

from my code and instead wait for a page to be fully loaded before the
program continues running, someone kindly told me to use:
Do Until ie.ReadyState = 4
DoEvents
Loop

However i was unable to get this to work, if anybody could offer some
help it would be greatly appreciated, my code is below:

Sub CDS_Test()

Dim ie As Object

Set ie = CreateObject("InternetExplorer.Application")

With ie
..Navigate "URL"
..Visible = True
Do Until .ReadyState = 4
DoEvents
Loop
End With

Set ipf = ie.Document.all.Item("p1_command")
ipf.Value = "my user ID"
Set ipf = ie.Document.all.Item("pw1_command")
ipf.Value = "my password"
SendKeys "{ENTER}"

Application.Wait Now + TimeValue("00:00:3")
SendKeys "{Tab 2}", True
SendKeys "{ENTER}"

Application.Wait Now + TimeValue("00:00:3")
SendKeys "{Tab 3}", True
SendKeys "{ENTER}"

Many Thanks,
Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top