Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Internet Explorer question - Refresh

Sometimes after I fire up my IE session, I get a 'web page is not available'
error. If I then click 'Refresh' (or go ieAmeritrade.refresh), the login
page loads correctly.

1) Is there a way to test before the Do loop to see if I have gotten the
real page or an error page?
2) What is the variable type of ipf?

Public Sub InitAmeritrade()
Dim ieAmeritrade As InternetExplorer

Set ieAmeritrade = New InternetExplorer
ieAmeritrade.Visible = True
ieAmeritrade.Navigate
"https://wwws.ameritrade.com/cgi-bin/spec_login.cgi?SP=LTC"
Do Until ieAmeritrade.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

'Log on
Set ipf = ieAmeritrade.Document.all.Item("USERID")


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default Internet Explorer question - Refresh


First of all this will not be before the do loop but after it and the do
loop has to be used again after refresh.

Then, If IEObject.ReadyState = READYSTATE_COMPLETE may not work some
times, especially when refreshed. If the page is completely loaded, IE
sometimes keep giving readystate as still loading. Therefore another
condition (if the statustext conatins word "Done") need to be added to
exit the do loop otherwise the do loop may go in infinite loop.

Third, the page error can be error generated because IE can not resolve
the URL address to IP address, (either DNS error, or internet link down)
OR the web site itself may generate error page (requested page not found
or temporarily down etc.) Therefore, I thought the better way would be
check if on the loaded page, Item("USERID") exists or not, if not, then
refresh.

Simple loop of keeping refreshing if above error found, may again land
in an infinite loop if internet link is down or DNS error. Therefore
better to do refresh a certain no. of times, still if the page is not
loaded, giver error message and exit. Below code will try refreshing 3
times:

Public Sub InitAmeritrade()
Dim ieAmeritrade As InternetExplorer, n As Integer
Set ieAmeritrade = New InternetExplorer
ieAmeritrade.Visible = True
ieAmeritrade.Navigate _
"https://wwws.ameritrade.com/cgi-bin/spec_login.cgi?SP=LTC"

n = 1
WaitLoop:
Do Until ieAmeritrade.ReadyState = READYSTATE_COMPLETE
DoEvents
If InStr(1, ieAmeritrade.StatusText, "Done") _
0 Then Exit Do

Loop
Set ifp = ieAmeritrade.Document.All.Item("USERID")
Err.Clear
On Error Resume Next
If IsError(ifp.Name) Then
If n 3 Then
MsgBox "Refreshing 3 times did not help"
'Instead of msgbox you can put a code to
'write log in to a cell 'could not open site'
ieAmeritrade.Quit
Exit Sub
End If
n = n + 1
ieAmeritrade.Refresh
GoTo WaitLoop:
End If
On Error GoTo 0
'Your remaining code from ifp = "Username" onwards.
End Sub




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Internet Explorer question - Refresh

Mr Sharad:
You have been a great help to me, and I thank you very much. This has shown
me several new ideas which I need to incorporate as well as having answered
several as yet un-asked questions.

-Tim

"Sharad" wrote in message
...

First of all this will not be before the do loop but after it and the do
loop has to be used again after refresh.

Then, If IEObject.ReadyState = READYSTATE_COMPLETE may not work some
times, especially when refreshed. If the page is completely loaded, IE
sometimes keep giving readystate as still loading. Therefore another
condition (if the statustext conatins word "Done") need to be added to
exit the do loop otherwise the do loop may go in infinite loop.

Third, the page error can be error generated because IE can not resolve
the URL address to IP address, (either DNS error, or internet link down)
OR the web site itself may generate error page (requested page not found
or temporarily down etc.) Therefore, I thought the better way would be
check if on the loaded page, Item("USERID") exists or not, if not, then
refresh.

Simple loop of keeping refreshing if above error found, may again land
in an infinite loop if internet link is down or DNS error. Therefore
better to do refresh a certain no. of times, still if the page is not
loaded, giver error message and exit. Below code will try refreshing 3
times:

Public Sub InitAmeritrade()
Dim ieAmeritrade As InternetExplorer, n As Integer
Set ieAmeritrade = New InternetExplorer
ieAmeritrade.Visible = True
ieAmeritrade.Navigate _
"https://wwws.ameritrade.com/cgi-bin/spec_login.cgi?SP=LTC"

n = 1
WaitLoop:
Do Until ieAmeritrade.ReadyState = READYSTATE_COMPLETE
DoEvents
If InStr(1, ieAmeritrade.StatusText, "Done") _
0 Then Exit Do

Loop
Set ifp = ieAmeritrade.Document.All.Item("USERID")
Err.Clear
On Error Resume Next
If IsError(ifp.Name) Then
If n 3 Then
MsgBox "Refreshing 3 times did not help"
'Instead of msgbox you can put a code to
'write log in to a cell 'could not open site'
ieAmeritrade.Quit
Exit Sub
End If
n = n + 1
ieAmeritrade.Refresh
GoTo WaitLoop:
End If
On Error GoTo 0
'Your remaining code from ifp = "Username" onwards.
End Sub




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Explorer da Excel Discussion (Misc queries) 4 October 9th 08 09:31 PM
internet explorer instance Manoj Excel Discussion (Misc queries) 0 February 1st 06 09:56 AM
Internet explorer download/XP Pro?? Maxwell-5000 Excel Discussion (Misc queries) 1 January 3rd 06 10:03 PM
Internet explorer problem Dave Peterson Excel Discussion (Misc queries) 0 January 24th 05 11:02 PM
internet explorer doris Excel Discussion (Misc queries) 1 January 5th 05 09:44 PM


All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"