Thread
:
how do I import .txt file as rows not columns?
View Single Post
#
4
Posted to microsoft.public.excel.misc
Steve Yandl
external usenet poster
Posts: 284
how do I import .txt file as rows not columns?
Phil,
Try this subroutine. Just edit the line that defines the path to your
actual text file.
_______________________________________
Sub GetEmailList()
Const ForReading = 1
strTxtFilePath = "C:\Test\AddyList.txt"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objFile = FSO.OpenTextFile(strTxtFilePath, ForReading)
strText = objFile.ReadAll
objFile.Close
strText = Replace(strText, vbCrLf, "")
arrText = Split(strText, ";")
For R = 0 To UBound(arrText)
Cells(R + 1, 1).Value = Trim(arrText(R))
Next R
Set FSO = Nothing
End Sub
_______________________________________
Steve
"Phil Zack" <Phil
wrote in message
...
I have a text file of several hundred email addresses, which I want to
import
into Excel (or Access). The data look like:
;
;
... etc
but when I use the Import External Data wizard, it imports the whole lot
as
columns in the first row, and cuts off the last few hundred, as there are
more than 255 records, so what I get looks like:
A / B /
C /
1/
/
/
How can I import them as single column entries in many rows? What I want
is
this:
A /
1/
/
2/
/
3/
/
Thanks in anticipation,
Phil
Reply With Quote
Steve Yandl
View Public Profile
Find all posts by Steve Yandl