Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default import huge text file line-by-line?

I'm trying to automate importing an enormous text file. The full file has
over 1000 fields (don't ask... it's just what I have to deal with). I want to
bring in around 150 or so of the fields. I recorded a macro using the text
import wizard. There were too many line continuations, so I tried to condense
the code into fewer lines. Because of the number of fields, however, there's
still way too much code and not enough allowable line continuations.

I've read suggestions for importing the text line by line and truncating
just what I want, but i'm not sure how to do it. The text file is delimited
with a ~ character. The first field has names formatted as "last, first" (no
quotes, but there is a comma). Because the first field is a name, the length
of that field will vary by person, as will the length of some of the other
fields. I don't know how to write the code that will snip out just those
fields i want while taking into account the varying length of some of the
fields.

Any help would be appreciated.
rachael
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default import huge text file line-by-line?


did you try the split function. You can use something like
fields = Split(line_number, "~")
This will put the fields in the array fields, and then you can impor
only those numbers which you want by referring to them as field(0)
field(4), field(21), etc...

- Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=27584

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default import huge text file line-by-line?

Haven't tried it, but i will. Thanks for the tip.
rachael

"mangesh_yadav" wrote:


did you try the split function. You can use something like
fields = Split(line_number, "~")
This will put the fields in the array fields, and then you can import
only those numbers which you want by referring to them as field(0),
field(4), field(21), etc...

- Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=275849


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text import with line wraps HKAPGMR Excel Discussion (Misc queries) 2 March 11th 09 12:31 AM
Text File Import leaves a blank row after each line R Kapoor Setting up and Configuration of Excel 0 January 8th 06 02:07 PM
Import only certain rows of a huge text file AriBari Excel Discussion (Misc queries) 4 July 11th 05 06:54 PM
Text import out of line? Krefty Excel Discussion (Misc queries) 3 December 21st 04 05:08 PM
Reads entire *.txt file into string opposed to a desired line by line input. ej_user Excel Programming 3 October 11th 04 07:15 PM


All times are GMT +1. The time now is 02:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"