How to read multiple text files into excel?

  • Thread starter Thread starter Together
  • Start date Start date
T

Together

Hi,
I have a big problem in my master thesis.
I want to read many text file into excel file for data analyses. Th
text files are so numerous that I can not read the files one by one. S
I plan to read it into excel by VBA code. But I just learn to how t
read one file into excel, and do not know how to deal with numerous.
can modify to name the files with number. My code:

Sub opentext()

Dim i As Integer


For i = 1 To 10000

Workbooks.opentext Filename:="D\:VB\10000+i.out", _ /The text file ca
be name as 10001, 10002,....
Origin:=xlMSDOS, _
StartRow:=1, _
DataType:=xlDelimited, _
ConsecutiveDelimiter:=True, _
Space:=True

Next i

End Sub

Obviously, the code can not work. Could somebody give me a help. Thank
in advanc
 
see response in programming.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top