View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
unni5959 unni5959 is offline
external usenet poster
 
Posts: 3
Default Help to improve macro

Hi
I found this cool macro on this group that makes a list of all files in
a folder. With each file name in a separate row. I would be very
grateful if any one can make suitable changes so that each row contains
a hyper link to the file.
TIA

Unni

Sub ListIndexFiles()
'Lists all file names in the folder on the active sheet
Dim FileName As String
Dim r As Integer

'Range("a2:a5").ClearContents

r = 2
With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings\Administrator\My
Documents"
.FileName = "*.doc"
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
FileName = Mid(.FoundFiles(i), 18)
Cells(r, 1) = FileName
r = r + 1
Next i
End If
End With
End Sub