Is there a way to get reported Valid or invalid in excel if an image URL gives a 404 error?
Without opening each image? eg checking header for 404?
here's some snippets I've tried
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
Public Function IsURLGood(url As String) As Boolean
Dim request As New WinHttpRequest
On Error GoTo IsURLGoodError
request.Open "HEAD", url
request.Send
If request.Status = 200 Then
IsURLGood = True
Else
IsURLGood = False
End If
Exit Function
IsURLGoodError:
IsURLGood = False
End Function
These report on all URLS, for me, TRUE. When I check, for example
http://www.bangallawebservices.com/images/BWA22055.jpg
these are definitely giving undesired results for return values, the above image is an example of the 404 error that's being counted as a valid URL in excel via these code snippets.
I've also tried the free demo of the Office PowerUp addin, with pwrISBROKENURL
which returned all false (not broken) when some are in fact broken. Excel is granted full access to internet through firewall.
https://www.youtube.com/watch?v=HU99-fXNV40