Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Get cell of broken Hyperlink

I've got a workbook with multiple hyperlinks in it. In this workbook i
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 lin
(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,
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

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Get cell of broken Hyperlink

Thanks, Tom!

Much appreciated!


~ Matt

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Broken Excel hyperlink to Word Template FC Excel Discussion (Misc queries) 0 May 20th 10 07:19 PM
hyperlink broken after email sfeng63 Excel Worksheet Functions 0 November 27th 07 12:21 AM
How do I create a hyperlink to a cell with the hyperlink function S. Bevins Excel Worksheet Functions 2 July 20th 06 08:06 PM
Copy hyperlink from one cell to/as hyperlink in another cell YogS Excel Worksheet Functions 6 January 12th 06 11:57 PM
Hyperlink to another row broken if inserting new row between, Help KJM Excel Discussion (Misc queries) 1 September 15th 05 07:15 PM


All times are GMT +1. The time now is 03:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"