View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default VBA to check if a URL is working

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 the

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

"Dileep Chandran" wrote in message
ups.com...
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