E
expect_ed
I want to extract data from a web page which is called with a Post method
which makes it impossible for me to indicate the URL, so I call the previous
page, where there is a link for the page I want and Sendkey Tab to the link
and Sendkey Enter. This brings up the page I want in a new window.
The problem is that page takes a while to load, and if I use:
Do While IE.readystate <> 4
DoEvents
Loop
Do While IE.busy = True
DoEvents
Loop
it does not work, apparently because Excel is still looking at the parent
window.
I tried using:
Dim IES As SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer
For Each IE In IES
If IE.LocationURL = "http://server.myURL.com:8080/requests.do" Then
Do While IE.readystate <> 4
DoEvents
Loop
Do While IE.busy = True
DoEvents
Loop
IE.Visible = True
Set IE = IE
Exit For
End If
Next
VBA seems to find the right window but when it finds it the window is still
loading data and the routine falls through to the next section which reads
the data and it errors out because table 300 is not there yet.
For now I'm using a sub pause work around to delay several seconds before
trying to find and read the new page, but I would like to get Excel to point
to the correct window so that the normal Do While code waits just long
enough, due to the variability in loading the page and because I am looping
through several hundred pages.
Any help greatly appreciat
ed
which makes it impossible for me to indicate the URL, so I call the previous
page, where there is a link for the page I want and Sendkey Tab to the link
and Sendkey Enter. This brings up the page I want in a new window.
The problem is that page takes a while to load, and if I use:
Do While IE.readystate <> 4
DoEvents
Loop
Do While IE.busy = True
DoEvents
Loop
it does not work, apparently because Excel is still looking at the parent
window.
I tried using:
Dim IES As SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer
For Each IE In IES
If IE.LocationURL = "http://server.myURL.com:8080/requests.do" Then
Do While IE.readystate <> 4
DoEvents
Loop
Do While IE.busy = True
DoEvents
Loop
IE.Visible = True
Set IE = IE
Exit For
End If
Next
VBA seems to find the right window but when it finds it the window is still
loading data and the routine falls through to the next section which reads
the data and it errors out because table 300 is not there yet.
For now I'm using a sub pause work around to delay several seconds before
trying to find and read the new page, but I would like to get Excel to point
to the correct window so that the normal Do While code waits just long
enough, due to the variability in loading the page and because I am looping
through several hundred pages.
Any help greatly appreciat
ed