Ron
many thanks for your help..... with one exception the code is doing as it should..... it is producing the list and creating a hyperlink from each file name..... however it is hyperlinking to the folder where the sheet containing the code and list is kept,,, not the folder where the files are stored........
I've been trying to adjust and figure it our myself,, but I'm not having any luck
JT
Dim iRow
Sub ListFiles()
iRow = 6
Call ListMyFiles(Range("C1"), Range("d1"))
End Sub
Sub ListMyFiles(mySourcePath, IncludeSubfolders)
Set MyObject = New Scripting.FileSystemObject
Set mySource = MyObject.GetFolder(mySourcePath)
Dim cCell As Range
On Error Resume Next
For Each myFile In mySource.Files
iCol = 2
Cells(iRow, iCol).Value = myFile.Path
iCol = iCol + 1
Cells(iRow, iCol).Value = myFile.Name
iCol = iCol + 1
Cells(iRow, iCol).Value = myFile.Size
iCol = iCol + 1
Cells(iRow, iCol).Value = myFile.DateLastModified
iRow = iRow + 1
Next
If IncludeSubfolders Then
For Each mySubFolder In mySource.SubFolders
Call ListMyFiles(mySubFolder.Path, True)
Next
End If
For Each cCell In Range("C6:c500").Cells
If cCell.Hyperlinks.Count = 0 Then
On Error Resume Next
ActiveSheet.Hyperlinks.Add _
Anchor:=cCell, _
Address:=cCell.Value, _
TextToDisplay:=cCell.Value
End If
Next cCell
End Sub
Bookmarks