I'm trying to use a button to auto insert hyperlinks for a selected range of cells based on the text inserted in these cells. The text would be a serial number (PDA007 for example) and the hyperlink will open a PDF of the same name. I can do this if all the PDF docs are in the same folder using the following
My problem is that the PDf's are not all in the same folder. They're in various sub folders located inside of the the Chair Specification folder.
How do I get the code to search through all the sub folders located in the Chair Specification folder?
Any help is appreciated.
Dave
Code:
Sub Add_Hyperlinks()
Dim c As Range
Dim sAddress As String
For Each c In Selection
If c <> "" Then
sAddress = "G:\Company\Scanned Chair Specification Files-Info\Chair Specification\" & _
Replace(c.Text, " ", "") & ".pdf"
c.Parent.Hyperlinks.Add _
Anchor:=c, Address:=sAddress, _
TextToDisplay:=c.Text
End If
Next c
End Sub
My problem is that the PDf's are not all in the same folder. They're in various sub folders located inside of the the Chair Specification folder.
How do I get the code to search through all the sub folders located in the Chair Specification folder?
Any help is appreciated.
Dave