tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,924
- Office Version
- 365
- 2019
- Platform
- Windows
This code checks if an URL exists:
However it doesn't seem to work if I put in an URL such as:
Instead I have to put:
How can I adapt the code so it will accept both urls?
Thanks
Code:
Function URLExists(url As String) As Boolean
Dim Request As Object
Dim ff As Integer
Dim rc As Variant
On Error GoTo EndNow
Set Request = CreateObject("WinHttp.WinHttpRequest.5.1")
With Request
.Open "GET", url, False
.Send
rc = .StatusText
End With
Set Request = Nothing
If rc = "OK" Then URLExists = True
Exit Function
EndNow:
End Function
However it doesn't seem to work if I put in an URL such as:
Code:
"bbc.co.uk"
Instead I have to put:
Code:
"https://www.bbc.co.uk"
How can I adapt the code so it will accept both urls?
Thanks