Jim Semaj:
try,
Sub filelist()
Dim fd As FileDialog
With Application.FileSearch
..NewSearch
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
If fd.Show = -1 Then
rpath = fd.SelectedItems(1)
Else
MsgBox "has not selected the Folder": Exit Sub
End If
..LookIn = rpath
..SearchSubFolders = True
..Filename = "* .xls"
The
..Execute
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
ActiveSheet.Hyperlinks.Add Anchor:=Cells(i, "A"), Address:= _
.FoundFiles(i), TextToDisplay:=.FoundFiles(i)
Next i
Else
MsgBox "has not detected file"
End If
End With
End Sub
if you want only list *.doc filename,then replace
.Filename = "* .doc"
--
天行健,君*以自強不息
地勢坤,君*以厚德載物
http://www.vba.com.tw/plog/
"Jim Semaj" wrote:
Want to be able to extract a list of filenames and import them into Excel or
Word.
Want a program or function or macro that works like many browse functions,
as in "file open" or "file save as", but, when you find the folder you want,
I want the function to at least create a text file that lists the file names
or much better still is available within Excel or Word and inserts the list
directly into the spreadsheet or document. A further advancement would be to
be able to list the filenames with or without associated file information,
rather like you can do with the "dir" command at the command prompt or like
"List" or "Details" as used in Windows. An enhancement would be to only list
a specified file type. e.g. only .doc or .jpg