This might work for you:
[vba]Private Function RCHGetURLData(pURL As String) As String
On Error GoTo ErrorExit
Dim oHTTP As New XMLHTTP
Dim timeOut As Double ' timeout in seconds
Dim timeOutTime As Double
timeOut = 60
timeOutTime = Timer + timeOut
oHTTP.Open "GET", pURL, False
oHTTP.Send
While oHTTP.Status <> "200"
DoEvents
If Timer < timeOutTime Then GoTo ErrorExit
Loop
RCHGetURLData = oHTTP.responseText
Exit Function
ErrorExit:
RCHGetURLData = vError
End Function[/vba]







Reply With Quote