Create Hyperlinks automatically

jcmckeon

New Member
Joined
Nov 4, 2015
Messages
38
Office Version
  1. 365
Platform
  1. Windows
Hello All,

I have my network path
\\str-file-01\org data\data\dept\employee training files\

I want to combine that with a folder name in this directory
Smith, John

And hopefully magic happens and the path and folder can combine and create a hyperlink

I'm not sure it can but it would save me HOURS AND HOURS

Thank you in advance
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
paste this code into a module, then run : HyperEachFolderName
it will list all folder in the sheet in col A.
Code:
Public Const kDIR = "\\str-file-01\org data\data\dept\employee training files\"
Sub HyperEachFolderName()
Dim fldr
 Dim oFile
Dim StartPath  As Object
Dim FileSystem As Object
   
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set StartPath = FileSystem.GetFolder(kDIR)
   
Range("A2").Select
    For Each fldr In StartPath.SubFolders
        ActiveCell.Value = fldr.Name
        ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=fldr, TextToDisplay:=fldr.Name
       
        ActiveCell.Offset(1, 0).Select  'next row
    Next
End Sub
 
Upvote 0
Ranman256, thank you for the reply. I'm getting a error. see attachment.
Thank you in advance.
 

Attachments

  • errorpath.png
    errorpath.png
    43.7 KB · Views: 6
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,506
Members
449,089
Latest member
RandomExceller01

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