Log in

View Full Version : read data in from text file



fraser5002
11-11-2008, 07:11 AM
Hi im looking to read data in from a text file line by line ( which is fine i can do) but in each row there is lots of data separted by tabs. How can i extract each bit of data and keep say data at tab 2,7,10,

i.e this is ten pieces of data i want to extract


read in from a text file in a line and extract it to keep the words "is" , "want" and "extract"

cheers

Fraser

jfournier
11-11-2008, 08:39 AM
Use the Split() function, which breaks a text string into an array based on some delimiter character you specify:


Dim StrParts() as String
StrParts = Split( "Here Is A String" , " " )


This will give you an array with 4 elements, one for each word (specify vbTab for delimiter if you want to use that...)