View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.links
Steve Steve is offline
external usenet poster
 
Posts: 1,814
Default Valid Hyperlinks being reported as Invalid

Because of problems with hyperlinks randomly changing without any
intervention a VBA procedure was written to perform various validation checks
on the hyperlinks. One of the checks is to see if the link actually exist
and if not report an error. Following is an excerpt of the VBA procedu

For Each h in Worksheets(curwksname).Hyperlinks
If (Dir(h.Address) = €œ€) then
Cells(errndx,1) = €œInvalid link to file: €œ& h.Address
errndx = errndx + 1
End If
Next

The Dir function return €œ€ for every hyperlink thus, they are all reported
as invalid. However, when selecting the hyperlink within the worksheet the
link works fine. So, why does the Dir function not locate the file?

Following is the value contained in h.Address:

...\..\..\dirnam1\dirnam2\dirnam3\dirnam4\dirnam5\ filename

where dirnam is the levels of directories..

Following is the value displayed when I place the cursor over the hyperlink
in the Excel spreadsheet:

file:///\\NetworkId\Groups\..\..\..\dirnam1\dirnam2\dirnam 3\dirnam4\dirnam5\filename

Thank you for your time.