forked from aaronkeene/ExcelVBA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestURL.vb
More file actions
25 lines (17 loc) · 655 Bytes
/
TestURL.vb
File metadata and controls
25 lines (17 loc) · 655 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Private Function TestURL(strUrl As String) As Boolean
'Requires Microsoft WinHTTP Services, Version 5.1
'Function returns TRUE is URL is found; FALSE if not found
'Default value of TestURL is FALSE
Dim oURL As New WinHttpRequest
On Error GoTo TestURL_Err
With oURL
.Open "GET", strUrl, False
.send
If .Status = 200 Then '200 indicates resource was retrieved
TestURL = True
End If
End With
TestURL_Err:
'Invalid resources cause an error; Function returns default value
Set oURL = Nothing 'Clean up object
End Function