Converting this macro that checks 404 status of a URL from Excel to LibreOffice on Ubuntu

Hi everyone,

A client I am working with has a ton of URLs that they need checked at once to see which ones return errors. They were able to find this YouTube video that shows how to make a macro that does this, but it only runs on Windows (we tried it on Excel on their Apple computers) and I use Ubuntu and LibreOffice.

I am thinking that maybe the script can be modified easily so that the macro works on Linux.

Here is a video that shows it in action:

The code is:

Public Function CheckURL(url As String)

Dim request As Object

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

On Error GoTo haveError

With request

    .Open "HEAD", url

    .Send

    CheckURL = .Status

End With

Exit Function

haveError:

CheckURL = Err.Description

Thank you!

EDIT:

While this hasn’t been solved and I am leaving it up since it may be of interest to others, my purposes are more or less served by https://httpstatus.io/

Why re-invent the wheel when there are already link checking programs out there? See for example LinkLint.

Thanks for bringing this to my attention. A few difficulties come to mind – my client needs to check 100+ links at once, and I’m not sure if this program can do that. I am also generally really bad at using computers and am barely sure how to get this program to run, but am looking into it.

Just an idea, if it’s easier to avoid macros at all, and simply put required URLs in the cells, and have something like =IF(ISERR(WEBSERVICE(A1));"FAIL";"OK") in B1.

This returns FAIL for every cell