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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If Statements

Status
Not open for further replies.

Pulp

MIS
Jul 22, 2002
18
US
I was wondering if anyone could give me some help on how to make If Statements repeat. As of right now I have a program that takes certain lines of information from one file, but it doesn't take all the certain lines of info that I want from the file. I use If Statements to retrieve these lines because all of theses lines have something in common with one another. All the lines I need have an S in the 38th character. As of right now, I can only get one line to appear. I was wondering if anyone could give me any help.
Thank You
 

The following will read in the entire file looking for "S" at the 38th character if it is found you can do your processing (look for comment). (This looks like a post from a couple of days ago.)

Dim FNumb as Integer, FName as String, TextLine As String

FName = "Your path to the file"
FNumb = FreeFile

Open FName For Input As #FNumb

Do While Not EOF(FNumb)

Line Input #FNumb, TextLine

If Mid(TextLine, 38, 1) = "S" Then

'do your processing here

End If

Doevents

Loop

Close #FNumb


Good Luck, I Hope This Helps
 
Thanks a lot!!! I'll give it a try
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top