mmahdi
asked on
Extracting fields from a tab delimited text file in VB5
Hi,
I am trying to extract information from a tab delimited text file. For example the info are are organised in the following;
field1 <tab> field2 <tab> field3 <tab> field4
<blank><tab> field2 <tab><blank> <tab> field4
I can programmatically open the file in excel which is going to organise the fields in columns but I am trying to avoid that. So I am looking for a way to extract field1, field2, field3 and field4.
Anyone can help?
Regards
MMAHDI
I am trying to extract information from a tab delimited text file. For example the info are are organised in the following;
field1 <tab> field2 <tab> field3 <tab> field4
<blank><tab> field2 <tab><blank> <tab> field4
I can programmatically open the file in excel which is going to organise the fields in columns but I am trying to avoid that. So I am looking for a way to extract field1, field2, field3 and field4.
Anyone can help?
Regards
MMAHDI
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It worked great! Thanks for your valuable help.
Regards
mmahdi
Regards
mmahdi
dim sChar as string
dim sField as string
Do While Not EOF(<filenumber>)
sField = ""
sChar = Input(1,<filenumber>)
Do While sChar <> chr(9) ' 9 = tab
sField = sField & sChar
sChar = Input(1,<filenumber>)
Loop
' Do Something with sField (ie set variable etc)
Loop