View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Read a single column text file

Just some added info: this doesn't work in Excel 97 or earlier. The
ability to import directly into a worksheet was added in Excel 2000.

--
Regards,
Tom Ogilvy

Dana DeLouis wrote in message
...
Would any ideas here help? The file "C:\junk.txt" would be your text

file.

Sub Demo()
'// Dana DeLouis
With ActiveSheet.QueryTables.Add( _
Connection:="TEXT;C:\junk.txt", _
Destination:=Range("B7"))

.RefreshStyle = xlOverwriteCells
.AdjustColumnWidth = True
.TextFileParseType = xlDelimited
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"mluetkem" wrote in message
...

Looking for a fast easy way to efficiently read a text file into a Excel
worksheet. The text file is a single column of real numbers. Size of
the text file can be 20,000+ lines long. I want to read in the text
file and place into column B starting at row 7. The text file and
Excel workbook are in the same directory. The size (length) of text
file will vary from run to run, but usually around 20,000 lines in
length.

Mike