Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenText Delimiter Problem

Status
Not open for further replies.

RH610

Programmer
Aug 7, 2001
152
US
I am given a text file; space delimited; with a date as the first field. Dates with a one digit month such as 71199 leave a space in the first column and the OpenText method screws up because it takes that first space as a delimiter. Any way around this? Note: I have no control over the format of the text file I am given and cannot not get it in any different form. I also would like to avoid massaging the text file before using OpenText because of speed considerations.

Thank You
 
Hi,

There may be a way, but not that I can see with the OpenText method.

I would run a quick conversion macro to load, strip and save the file.

filefreeA=freefile
Open "abc.txt" for input as #filefreeA
filefreeB=freefile
Open "xyz.txt" for output as #filefreeB

While not(eof(filefreeA))
input #filefreeA,X$
write #filefreeB,trim(x$)
wend

close #filefreeB
close #filefreeA

Workbooks.OpenText filename:="XYZ.txt", blah blah blah

Its not fast, its not what you want but it should work.

Any Help, Yes/No let me know

Regards

________________________________________
Is not a fool a wise man in his own eyes - Proverbs
 
Hi,

That totally worked. I didn't want to have to massage the files like that due to speed considerations, but what with today's powerful PCs, it didn't seem too bad.

Thanks Again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top