View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Get cell of broken Hyperlink

if that successfully finds the broken link, then to color the cell:

Public Sub VerifyLinks()
Dim sAddr As String
Dim lnk As Hyperlink

For Each lnk In ActiveSheet.Hyperlinks
sAddr = lnk.Address
If Dir(sAddr) = "" Then
'MsgBox "Link NOT found!"
' Select cell and change color
lnk.parent.Interior.ColorIndex = 6
Else
'MsgBox "Link found!"
End If
Next
End Sub

--
Regards,
Tom Ogilvy

"BVHis " wrote in message
...
I've got a workbook with multiple hyperlinks in it. In this workbook is
a macro to verify the existance of each link.

What I'd like to be able to do is select the cell of the broken link
(if and when one is found) and change the color of the cell.

Here's what I've got for verifying the existance of the links (sorry, I
don't remeber who I "borrowed" this from in this forum).

Public Sub VerifyLinks()
Dim sAddr As String
Dim lnk As Hyperlink

For Each lnk In ActiveSheet.Hyperlinks
sAddr = lnk.Address
Debug.Print lnk.Address
If Dir(sAddr) = "" Then
MsgBox "Link NOT found!"
' Select cell and change color
Else
MsgBox "Link found!"
End If
Next
End Sub

Thanks in advance!

Matt W


---
Message posted from http://www.ExcelForum.com/