raychung666
New Member
- Joined
- Mar 29, 2008
- Messages
- 20
I wanted to query a series of stocks from a website using the following routine. It seemed that the do loop couldn't check the ready status of ie. When I ran the macro, stock 2866 was skipped and only stock 13 was displayed. May be it was so fast that I couldn't see 2866 being displayed. When I ran it line by line, it was working fine. Was the following do loop a good way to check the status of ie?
Sub test5()
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate "http://www.quamnet.com/quote.action"
Do While ie.Busy And Not ie.ReadyState = 4
DoEvents
Loop
ie.document.forms(4)("stockcode").Value = "2866"
ie.document.forms(4).submit
Do While ie.Busy And Not ie.ReadyState = 4
DoEvents
Loop
ie.document.forms(4)("stockcode").Value = "13"
ie.document.forms(4).submit
Do While ie.Busy And Not ie.ReadyState = 4
DoEvents
Loop
'ie.Quit
'Set ie = Nothing
End Sub
Sub test5()
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate "http://www.quamnet.com/quote.action"
Do While ie.Busy And Not ie.ReadyState = 4
DoEvents
Loop
ie.document.forms(4)("stockcode").Value = "2866"
ie.document.forms(4).submit
Do While ie.Busy And Not ie.ReadyState = 4
DoEvents
Loop
ie.document.forms(4)("stockcode").Value = "13"
ie.document.forms(4).submit
Do While ie.Busy And Not ie.ReadyState = 4
DoEvents
Loop
'ie.Quit
'Set ie = Nothing
End Sub