I have an excel file that has 500+ links to files on my network. Due to the file names/paths changing, the links frequently break. I am looking for a way to test all the links at once. I found this thread: http://www.excelforum.com/excel-prog...yperlinks.html
Sub TestHLinkValidity()
Dim rRng As Range
Dim fsoFSO As Object
Dim strFullPath As String
Dim cCell As Range
Set fsoFSO = CreateObject("Scripting.FileSystemObject")
Set rRng = Selection
For Each cCell In rRng.Cells
If cCell.Hyperlinks.Count > 0 Then
strFullPath = ActiveWorkbook.Path & "\" & cCell.Hyperlinks(1).Address
If fsoFSO.FolderExists(strFullPath) = False Then
cCell.Interior.ColorIndex = 3
Else
cCell.Interior.ColorIndex = 0
End If
End If
Next cCell
End Sub
This seems to work fine in several small test files I made, linking to files on my local machine. However, when I use it on the large file it reports links as broken that are not broken. Does anyone have an idea as to why that is and how to fix it? Any help would be much appreciated, and I apologize if this answer is out there somewhere, I looked but could not find it.
-Thumbs
Bookmarks