Skip to content

Instantly share code, notes, and snippets.

@can3p
Created March 21, 2013 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save can3p/5214873 to your computer and use it in GitHub Desktop.
Save can3p/5214873 to your computer and use it in GitHub Desktop.
chech url in vba
Function Alive(ByVal url As String) As String
Dim result As String
Dim winHttpReq As Object
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
winHttpReq.Open "GET", url, False
On Error Resume Next
winHttpReq.Send
If Err.Number = 0 Then
If winHttpReq.Status = "200" Then
Alive = "1"
Else
Alive = "0"
End If
Else
Alive = "0"
End If
On Error GoTo 0
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment