Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Since all of your fields are ^-delimited you could just read in the whole
file as a single string and then loop through one character at a time. Each time you hit a "^", toggle an "Infield" boolean. If you hit a newline while bInfield is false then start a new row in Excel. Tim. "Dick Kusleika" wrote in message ... Greg Look at the code here http://www.dicks-blog.com/archives/2...t-text-in-vba/ I couldn't figure what to do with the carriage returns. If Line Input encounters a Chr$(13), it figures it's at the end of the line. You would need some way to determine if you really were at the end of the line. Maybe you could keep a running count of delimeters and only icrease lRow when you know you've had 50 columns (or whatever). Anyway, this should be a good place to start and we can take it from there. -- Dick Kusleika Excel MVP Daily Dose of Excel www.dicks-blog.com Greg wrote: "Dick Kusleika" wrote in message ... Greg Option 1: Write a VBA procedure that reads in the text file and cleans out the characters you don't want, then writes to cells. You would use VBA's file operation keywords like Open, Input, FreeFile. Option 2: Import the text with all the characters you want, then do a find and replace to get rid of the stuff you don't want. Post back if you need help with either of those options. -- Dick Kusleika Excel MVP Daily Dose of Excel www.dicks-blog.com Greg wrote: Can you please assist. I have a text file that can incldue tabs, CR, and LF in the one field, so I have delimeted the fields using a ^. eg a field can be any combination of ^abcd....CR..abcd.TAB..abcd..CR..^ I wish to import the txt without the tabs, CR and LF. The file contains about 24 columns, by about 200 rows. What are my bext options? Thank you Dick. Can you please help with option 1. I am currently using word to do this. I would a preciate code for an alternative solution. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Importing CSV file (saved as Text) into XL as Text -- over 60 colu | Excel Discussion (Misc queries) | |||
Importing text file | Excel Discussion (Misc queries) | |||
Importing text file, only option to edit existing file | Excel Discussion (Misc queries) | |||
Importing Text File | Excel Programming | |||
importing text file, removing data and outputting new text file | Excel Programming |