Extracting information from a text file

newton1234

Registered User.
Local time
Today, 13:48
Joined
Apr 16, 2008
Messages
12
Hi,

I am trying to write a module which looks at a large text file and pulls out certain parts.

I have written it in a way where I have declared a variable (file) and told it which line to look at (eg. If file Like "*Data*" Then Data1 = Trim(Right(Left(file, 10), 3))).

However my problem is that I have around 32 lines where there is nothing on the line that stays the same (as it is addresses so always different) therefore I dont know how to tell the file to look at a specific line.

On the line, I am looking to pick up a 5 digit number (which again always changes). The numbers always go up in value, so line one could be 12345 so line two would be a higher number eg, 23456.

Can anyone think of a way in which I can pull this information out.

If you would like an example of what my text file looks like please advise.

Thanks in advance.
 
Simple Software Solutions

Try looking at

Open YourFile for Input As #1

where YourFile is the name of your text document

then use

loop through each line of the document until you hit a line that contains "Data" in it
extract the parsed element of the line then exit the loop. Close #1
 
Thanks for your response.

I will try this, however its not just one line that contains the word "data". So how do I tell the module to keep looking and return every line which contains it ?!

I thought about declaring variables as i = 1 and j = 1 to 32
Then saing looking for Data(i)
Loop i=i+1

Can anyone think of an easier or quicker way ?

Thanks
 

Users who are viewing this thread

Back
Top Bottom