Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Text import with line wraps | Excel Discussion (Misc queries) | |||
Text File Import leaves a blank row after each line | Setting up and Configuration of Excel | |||
Import only certain rows of a huge text file | Excel Discussion (Misc queries) | |||
Text import out of line? | Excel Discussion (Misc queries) | |||
Reads entire *.txt file into string opposed to a desired line by line input. | Excel Programming |