Hi guys,
maybe some one can hep me with this.
I am trying to test URL from a script if they exist or not. the one problem is that if the website hangs then the code never completed as it does not get a return.
I want to create a bit of code to time out after X second if the httpRequest.send command does not return.
Set HttpRequest = CreateObject("Msxml2.XMLHTTP")
HttpRequest.Open "HEAD", "http://www.google.co.uk", False
On Error Resume Next
HttpRequest.send
<HttpRequest.timeout = 100>
If Err.Number <> 0 Then
Sheets("Nomads URLs").Cells(x, 2).Value = ("Error : " & Err.Number & ": " & Err.Description)
Else
Sheets("Nomads URLs").Cells(x, 2).Value = ("HTTP status: " & HttpRequest.Status & " " & HttpRequest.statusText)
End If
Any ideas?
Cheers