Auto hyperlink

WIGG77

New Member
Joined
Jun 25, 2014
Messages
49
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

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
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,224,828
Messages
6,181,217
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top