View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Testing for hyperlink error

Hi James,

Am Sun, 7 Jul 2013 06:56:11 +0100 schrieb James W. Johnson:

I have an artifact database with a bit over 4000 entries, and I'm using
the hyperlink function to 'attach' a jpg photo to each artifact. The
problem is that not all artifacts have a photo, and I wish to be able to
use a column to indicate which links are valid, and which yet need a
photo.
How do I test for a lack of photo, using hyperlink? I do get a message
informing me of the missing photo, but I hope not to have to go through
the database one artifact at a time...


your hyperlinks in column A.
Put following function in a standard module and call the function into
the sheet with:
=picExists(A1)

Function picExists(myCell As Range) As Boolean
Dim strFile As String

strFile = Replace(myCell.Hyperlinks(1).Address, "File///", "")
picExists = IIf(Dir(strFile) < "", True, False)
End Function

Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2