VBA to check if a URL is working

D

Dileep Chandran

To the masters of microsoft excel:

Is it possible using a VBA to check a couple of links
(Range("A1:A100")) are working properly?

I want to open the URL and check if that particular article has been
expired or not?

Is there a way to do it?

Thanks & Regards

-Dileep Chandran
 
N

NickHK

Dileep,
Something like this, although there are probably other errors that that will
cause the method to fail that you should include.
Just try and get it and if it fails, then it's not there:

Private Sub CommandButton1_Click()
On Error GoTo Handler

ThisWorkbook.FollowHyperlink
"http://yoursite.com/somefilethatdoesnotexist.txt"

Exit Sub
Handler:

Select Case Err.Number
Case -2146697210
MsgBox "File not available"
Case Else

End Select
End Sub

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top