View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Akash Akash is offline
external usenet poster
 
Posts: 125
Default Paste filenames into cells

Dear Don,
I was going through the earlier one of your mail on 14th Dec regarding
Paste filenames into cells

there u have given a code

Sub GetFileList()
Dim iCtr As Integer

With Application.FileSearch
.NewSearch
.LookIn = "c:\aa"
.SearchSubFolders = True
.Filename = ".xls"
If .Execute 0 Then
For iCtr = 1 To .FoundFiles.Count
Cells(iCtr, 1).Value = .FoundFiles(iCtr)
Next iCtr
End If
End With
End Sub
=====
or DIR

Sub anotherfindfiles()
Application.ScreenUpdating = False
Dim FN As String ' For File Name
Dim ThisRow As Long
Dim MediaFileLocation As String
MediaFileLocation = "c:\yourfolder\*.xls"
FN = Dir(MediaFileLocation)
Do Until FN = ""
ThisRow = ThisRow + 1
Cells(ThisRow, 1) = FN
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub

I am not able to execute it. Or u can say i m not able understand how
the macro works.
How the user can select files from a single folder. Instead of opening
them.

Awaiting for ur mail...

Regards

Akash