VBA to check if a URL is working

  • Thread starter Thread starter Dileep Chandran
  • Start date Start date
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
 
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
 
Back
Top