View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
RobN[_2_] RobN[_2_] is offline
external usenet poster
 
Posts: 230
Default Importing Text files to Excel 2007

Jim,

Could you also advise what the code would be if I wanted to include the
files within any subfolders?

Rob

"Jim Rech" wrote in message
...
You can get a quick list of the files in a folder with this macro. Put
the folder path in cell A1.

Sub a()
Dim FilePath As String
Dim FName As String
Dim Counter As Integer
FilePath = Range("A1").Value
If Right(FilePath, 1) < "\" Then FilePath = FilePath & "\"
FName = Dir(FilePath & "*.*", vbNormal)
Do While FName < ""
Counter = Counter + 1
Cells(Counter + 1, 1).Value = FName
FName = Dir
Loop
End Sub


--
Jim
"Quco" wrote in message
...
Marvin,

Back in 1986 I learned a little bit of MS-DOS commands with an Atari XT
computer I used just for fun, but I can't remember how to use these
commands
now.

This is what I have done so far:

1. File Run cmd
2. Enter G: to switch to the location of the hard drive

Now, the actual path for the folder containing all these files is:
G:\Gulf

Unfortunately I can't get in the Gulf folder to try the command "dir/s
files.txt"
I do not understood the rest of your instructions. Could you please
clarify?