View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1237_] Rick Rothstein \(MVP - VB\)[_1237_] is offline
external usenet poster
 
Posts: 1
Default import multiple text files into single sheet separate column

A couple of questions...

1. Do your text files all have a common name with a numerical identifier in
them. For example, the text file you show in your example is named "1
totaal.txt"... aside from the possible misspelling of the word 'total', do
the other 199 files have a number in front, followed by a space followed by
the exact text "totaal.txt"? If not, is there a way to identify these files
in a preferred ordering.

2. Is the content of each text file a series of rows of data consisting of a
single value?

Rick


"Jootje" wrote in message
...
Hi,

I have a folder with over 200 txt files and I want to put those into a
single worksheet. Each file should be placed in a different column. That
is,
file 1 into A2 and file 2 in B2 etc.

The data I want from the txt files concerns only one column. I recorded a
macro for it.

Workbooks.OpenText Filename:= _
"D:\report files\report files txt\1 totaal.txt" _
, Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:=
_
xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False,
Semicolon:=False, _
Comma:=False, Space:=True, Other:=False, FieldInfo:=Array(Array(1,
9), _
Array(2, 1), Array(3, 9), Array(4, 9), Array(5, 9), Array(6, 9),
Array(7, 1)), _
TrailingMinusNumbers:=True
ActiveWindow.SmallScroll Down:=105

I think the point is, with all the macro's found on this newsgroup I don't
know how to use them or to alter them in my case. Probably change
something
in the merge section? Or maybe not. Maybe a totally different approach? I
think the solution can be simple, but I don't see it.

Any ideas?
Thanks