Importing text file
I'm trying to get a macro which imports any text file selected from a
directory C:\Data\Archive.
The recorded macro is:
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Data\Archive\Mydata.txt", Destination:=Range("A1"))
.Name = "Mydata"
etc.
This relates to a specific file whereas I want to import any text file
in that directory
I've tried lots of variations including:
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Data\Archive", Destination:=Range("A1"))
.Name = Application.GetOpenFilename
but they don't work.
I'd really appreciate any ideas.
Thanks a lot
|