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

asked 2021-04-13 12:35:08 +0200

SerafimF1 gravatar image

updated 2021-04-13 14:32:50 +0200

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


    CheckURL = .Status

End With

Exit Function


CheckURL = Err.Description

Thank you!


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

edit retag flag offensive close merge delete


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

robleyd gravatar imagerobleyd ( 2021-04-13 13:50:01 +0200 )edit

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.

SerafimF1 gravatar imageSerafimF1 ( 2021-04-13 14:17:57 +0200 )edit

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.

Mike Kaganski gravatar imageMike Kaganski ( 2021-04-13 15:14:23 +0200 )edit

This returns FAIL for every cell

SerafimF1 gravatar imageSerafimF1 ( 2021-04-14 14:38:33 +0200 )edit