Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default is hyperlink valid ?

I have a spreadsheet in which column H contains hundreds of hyperlinks. I
have a problem with links becoming "stale"

Is there a wasy, using VBA, to scan down the column and high-light any cells
containing a "stale" link ?

Thanks in advance for any help.
--
jake
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default is hyperlink valid ?

As hyperlinks can be refer to numerous types of destinations, (ranges,
files, specific locations within files, etc) the only sure way would be to
account for each of the different types. Or just .FollowHyperlink and check
for errors. That would mean opening each of the applications responsible for
the file in the hyperlink, which be quite time consuming.
If you just want to test for valid external files, then maybe this should
get you started:

Private Sub CommandButton1_Click()
CheckHyperlinks Cells
End Sub

Public Function CheckHyperlinks(argRange As Range) As Long
Dim HLink As Hyperlink

For Each HLink In argRange.Hyperlinks
If IsFileValid(HLink.Address) = False Then HLink.Range.Interior.Color =
vbRed
Next

End Function

Public Function IsFileValid(FilePathName As String) As Boolean
On Error GoTo Handler

GetAttr (FilePathName)
IsFileValid = True
Exit Function
Handler:
IsFileValid = False
End Function

Not how mapped drives behave here and remote files (e.g. on e the web) would
need another approach.

NickHK

"Jakobshavn Isbrae" wrote in
message ...
I have a spreadsheet in which column H contains hundreds of hyperlinks. I
have a problem with links becoming "stale"

Is there a wasy, using VBA, to scan down the column and high-light any

cells
containing a "stale" link ?

Thanks in advance for any help.
--
jake



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
Hyperlink - reference not valid Tesons Excel Discussion (Misc queries) 3 April 4th 23 11:21 AM
hyperlink reference not valid Dannycol Excel Worksheet Functions 0 April 10th 06 03:36 PM
? Hyperlink; reference not valid ? [email protected] Excel Discussion (Misc queries) 1 March 7th 06 10:40 PM
Getting a valid position of hyperlink Fedir Nedashkovsky Excel Programming 0 November 19th 04 01:35 PM
Checking If Hyperlink Is Valid Steve[_32_] Excel Programming 2 September 14th 03 03:05 AM


All times are GMT +1. The time now is 01:24 PM.

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

About Us

"It's about Microsoft Excel"