View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default hyperlink to files

Steve,

Change the .LookIn path as needed.... The list will start in the activecell

Sub FindFilesAndHyperlink2Them()
Dim i As Integer
With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings\Foldername\My Foler"
'.SearchSubFolders = True
.MatchTextExactly = False
.FileType = msoFileTypeAllFiles
If .Execute(msoSortOrderDescending) 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count
ActiveCell.Cells(i, 1).Value = .FoundFiles(i)
ActiveCell.Cells(i, 2).FormulaR1C1 = "=HYPERLINK(RC[-1])"
Next i
Else
MsgBox "There were no files found."
End If
End With

End Sub



HTH,
Bernie
MS Excel MVP


"Steve_n_KC" wrote in message
...
Assuming it's possible, could someone help me with the macro code to get all
the file names, regardless of type, within a specific folder and then list
those names including as much as possible of the file path in a column of the
sheet that I execute the macro from?

If the macro can pull the info in as a hyperlink that would be a bonus but I
can work that separately if needed.

I need this to be something that I can assign to a button so that the user
can update the list prior to each use.
--
THANKS!

Steve