Thread
:
how do I import .txt file as rows not columns?
View Single Post
#
6
Posted to microsoft.public.excel.misc
Phil Zack[_2_]
external usenet poster
Posts: 3
how do I import .txt file as rows not columns?
Thanks Steve,
Sorry to sound dim, but what DO I actually do with this program?
Do I paste it somewhere and click run, or do I need to go into DOS and type
it in, or what?
Thanks,
Phil
"Steve Yandl" wrote:
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
Phil Zack[_2_]
View Public Profile
Find all posts by Phil Zack[_2_]