Read contents of web page

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a folder for which I have set the home page to point to a website
that contains a timetable in the form of text. Is there any way that I can
programattically extract this text from the folder itself?

Thanks

Pierre
 
Am Thu, 2 Feb 2006 10:49:07 -0800 schrieb Pierre Scerri:

Pierre, I´d use the "Microsoft Internet Controls" to navigate to the site
and get its content.
 
Hi Michael

Thank you for the reply. Can you point me to a small example please?

Thanks again

Pierre
 
Am Fri, 3 Feb 2006 08:00:26 -0800 schrieb Pierre Scerri:

Private WithEvents IE As InternetExplorer

Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Debug.Print pDisp.Document.Body.innerText
End Sub

Private Sub Form_Load()
Set IE = New InternetExplorer
IE.Navigate2 "http://www.vboffice.net"
End Sub
 
Hi Michael

Thanks a lot. It worked.

Pierre

Michael Bauer said:
Am Fri, 3 Feb 2006 08:00:26 -0800 schrieb Pierre Scerri:

Private WithEvents IE As InternetExplorer

Private Sub IE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Debug.Print pDisp.Document.Body.innerText
End Sub

Private Sub Form_Load()
Set IE = New InternetExplorer
IE.Navigate2 "http://www.vboffice.net"
End Sub
 
Hi

The website I am trying to access requires a username and password which the
website remembers, but it pops up a box to acknowledge them. I have been
trying to bypass this by using the SENDKEYS "{ENTER}" command as follows:

If IExplr Is Nothing Then Set IExplr =
CreateObject("InternetExplorer.Application")
IExplr.Navigate Url
SENDKEYS "{ENTER}"
Do ' wait till iexplore is done.
Loop Until .ReadyState = READYSTATE_COMPLETE
a = .Document.Body.innertext ' put the whole page into a string

etc.....

but it doesn't seem to work. I have tried putting the SENDKEYS in different
places, but it doesn't help.

Any ideas would be most welcome.

Thanks

Pierre
 
Update

Ok I've sorted the username/password problem. Discovered the Headers:=
parameter of webbrowser.navigate.

The problem now is this:

If IExplr Is Nothing Then Set IExplr =
CreateObject("InternetExplorer.Application")
With IExplr
.Navigate Url:=Url, headers:="Authorization: Basic XXXXXX" & Chr$(13) &
Chr$(10)
Do ' wait till iexplore is done.
Loop While .Busy
a = .Document.Body.innertext ' put the whole page into a string
....rest of code

Now this code is in a Sub which is called twice in a row with a different
URL from the same website.

The first url may be: http://fmywebsite.com/Rst/OPS/FEB/2CPT.HTM
The second url may be: http://mywebsite.com/Rst/OPS/MAR/2CPT.HTM

After the second call, 'a' is still the result of the first call. ie it
does not get updated. This only happens when I first run the program.
Subsequent double calls while the program is running, work properly.

Also, sometimes, the Do Loop While .Busy exits and the data is not complete.

Heeeeelp!!!
 
Am Thu, 9 Feb 2006 10:41:33 -0800 schrieb Pierre Scerri:


Why don´t you use the DocumentComplete event as shown? If that event fires
*then* the download is complete and you can navigate to another URL.

Also, a Do While loop needs 100% of your CPU time. That´s not a good idea
even if it would work.
 
Back
Top