Jaymond Flurrie
Well-known Member
- Joined
- Sep 22, 2008
- Messages
- 921
- Office Version
- 365
- Platform
- Windows
I have a pretty simple function,
Why doesn't strContent always include the whole page? I mean, sometimes the length (len(strContent)) might be even six times longer than other times. And yes, the source page is same (I tried with www.nhl.com) and the source code has a lot more than what this function returns. Is there some timing limits or some other things that are not necessarily obvious?
I've been running this on Excel 2007 on Windows XP. My Internet connection is 100/5 Mb.
Code:
Function GetTextFromIe(strURI As String) As String
Dim ie As Object
Dim objDoc As Object
Dim strContent As String
Set ie = Nothing
Set ie = CreateObject("internetexplorer.application")
ie.Navigate strURI
Do
If ie.ReadyState = 4 Then
ie.Visible = False
Exit Do
Else
DoEvents
End If
Loop
Set objDoc = ie.Document
strContent = objDoc.body.outerHTML
Set objDoc = Nothing
ie.Quit
Set ie = Nothing
GetTextFromIe = strContent
End Function
Why doesn't strContent always include the whole page? I mean, sometimes the length (len(strContent)) might be even six times longer than other times. And yes, the source page is same (I tried with www.nhl.com) and the source code has a lot more than what this function returns. Is there some timing limits or some other things that are not necessarily obvious?
I've been running this on Excel 2007 on Windows XP. My Internet connection is 100/5 Mb.