ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Links and Linking in Excel (https://www.excelbanter.com/links-linking-excel/)
-   -   Valid Hyperlinks being reported as Invalid (https://www.excelbanter.com/links-linking-excel/214493-valid-hyperlinks-being-reported-invalid.html)

Steve

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.


All times are GMT +1. The time now is 07:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com