ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   copy & paste (https://www.excelbanter.com/excel-discussion-misc-queries/29959-copy-paste.html)

Ray A

copy & paste
 
I would like to copy all the file names from a folder in explorer into Excel.
Is this possible? I am using Window XP and Excel 2003

Bernie Deitrick

Ray,

Dim i As Integer
With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings"
.FileType = msoFileTypeAllFiles
.SearchSubFolders = False
If .Execute 0 Then
For i = 1 To .FoundFiles.Count
Range("A" & i).Value = .FoundFiles(i)
Next i
End If
End With

HTH,
Bernie
MS Excel MVP


"Ray A" <Ray wrote in message
...
I would like to copy all the file names from a folder in explorer into

Excel.
Is this possible? I am using Window XP and Excel 2003




ALLM

copy & paste
 
This is good info but I am not a programmer. Is there an alternative way to
do this. If not in Exel something else maybe?

Al

"Bernie Deitrick" wrote:

Ray,

Dim i As Integer
With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings"
.FileType = msoFileTypeAllFiles
.SearchSubFolders = False
If .Execute 0 Then
For i = 1 To .FoundFiles.Count
Range("A" & i).Value = .FoundFiles(i)
Next i
End If
End With

HTH,
Bernie
MS Excel MVP


"Ray A" <Ray wrote in message
...
I would like to copy all the file names from a folder in explorer into

Excel.
Is this possible? I am using Window XP and Excel 2003





Bryan Hessey

copy & paste
 

One method:

click Start, Run and type CMD (to run a DOS window)

type CD\MyFolder
using the path to your folder
something like CD\Documents and Settings\MyFiles

type DIR /-b /w ListFiles.txt
to copy a list of filenames to a file


type Exit
to close this window

This file (ListFiles.txt) can be opened into Excel.

Hope this helps

--

Ray A Wrote:
I would like to copy all the file names from a folder in explorer into
Excel.
Is this possible? I am using Window XP and Excel 2003



--
Bryan Hessey
------------------------------------------------------------------------
Bryan Hessey's Profile: http://www.excelforum.com/member.php...o&userid=21059
View this thread: http://www.excelforum.com/showthread...hreadid=377755



All times are GMT +1. The time now is 08:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com