Guidance for checking broken image links in Excel.


Code to use:


Public Function IsURLGood(url As String)

    Dim request As Object

    Set request = CreateObject("WinHttp.WinHttpRequest.5.1")

    On Error GoTo haveError

    With request

        .Open "HEAD", url

        .Send

        IsURLGood = .Status

    End With

    Exit Function

haveError:

    IsURLGood = Err.Description

End Function

 

 

Sub ProcessUrls()

    Dim c As Range

    For Each c in Activesheet.Range("A1:A20000").Cells

        c.Offset(0, 1).Value = IsURLGood(c.Value) 'put result in ColB

    Next c

End sub


Source of code - https://stackoverflow.com/questions/44813295/how-to-do-image-url-validation-in-excel-2016/44813655#44813655