AndrewKent
Well-known Member
- Joined
- Jul 26, 2006
- Messages
- 889
Hi there,
I use the following procedure to extract source code from web pages, which I then in turn extract links from:
which is used by this line of code in another procedure:
This works 99% of the time perfectly, but every so often, this function causes Excel to freeze (Excel is running, but it comes up Not Responding, until I Task Manager and close).
All I can think of is that the routine can't access the web page I have asked it to, causing the program to hang.
Can anyone suggest any error checking routines or improvements to this?
Kind regards,
Andy
I use the following procedure to extract source code from web pages, which I then in turn extract links from:
Code:
Function GetSource(sURL As String) As String
' =============================================================================================
' =============================================================================================
On Error GoTo NoData
Dim oXHTTP As Object
Set oXHTTP = CreateObject("MSXML2.XMLHTTP")
oXHTTP.Open "GET", sURL, False
oXHTTP.send
GetSource = oXHTTP.responsetext
Set oXHTTP = Nothing
NoData:
End Function
which is used by this line of code in another procedure:
Code:
strSourceCode = GetSource("" & strSLR_ActiveAddress & "")
This works 99% of the time perfectly, but every so often, this function causes Excel to freeze (Excel is running, but it comes up Not Responding, until I Task Manager and close).
All I can think of is that the routine can't access the web page I have asked it to, causing the program to hang.
Can anyone suggest any error checking routines or improvements to this?
Kind regards,
Andy