Checking If Hyperlink Is Valid

S

Steve

I am trying to write a macro that will test a hyperlink, which is contained
in a cell, to a file or folder to see if the link is valid without actually
opening the file or folder. However, I'm not that familiar with VBA code
working with the Internet. So I'm at a lose as to how to proceed.

So far I have the code below, but I'm not sure what to do with it now or if
I'm really on the right track. (Assume the cell contains a link to
'file.txt' as shown on the third line.)

Sub HyperlinkTest()
Set oITC = New InetCtlsObjects.Inet
oITC.URL = "HTTP://www.abc.com/file.txt"
(don't know how to check for any errors, etc. that would tell me if the
link is valid)
End Sub

I'd appreciate any advise from someone who has had experience with this type
of situation.
 
S

Steve

Thanks for the feedback, Paul. Actually, I had tried that code before, but
I always got a blank when invoking the GetHeader command even for valid
links.

Do you know if GetHeader also works with links to files and folders as well
as HTML pages? If it does, I'm not sure why I always get blanks with
GetHeader.
 

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