Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Couldn't you just keep track to see if the input line should be skipped or
processed. Dim ProcessThisLine as boolean dim sData as string ProcessThisLine = false Open x For Input As #1 Do While EOF(1) Line Input #1, sData if instr(1,sdata,"startkeyword",vbtextcompare) 0 then processthisline = true else if instr(1,sdata,"endkeyword",vbtextcompare) 0 then processthisline = false else if processthisline = true then 'add it to your textbox end if end if end if Loop This will exclude the top and bottom indicator lines. I'm not sure if that's what you want. (Untested, uncompiled. Watch for typos!) ExcelMonkey wrote: I Am loping through a text file. I need to take two passes at the file. When I exit the first loop I then proceed to the next loop where I want to start searching the file again from the first line. However the sData variable is still set to the line where the first loop exited the Do. How do I restart this? I tried using the "Open x For Input As #1" again in the second loop but I recieved an error message saying the file was already open. 'First Pass Open x For Input As #1 Do While EOF(1) Line Input #1, sData LineCount = LineCount + 1 If some condition = True Then Exit Do End if Loop LineCount = 0 'Second Pass Do While EOF(1) Line Input #1, sData LineCount = LineCount + 1 'Do something Loop Thanks EM -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
taking the file extension out of the file name | Excel Discussion (Misc queries) | |||
display text when mouse passes over a line | Excel Programming | |||
Excel File Taking Forever to Open | Excel Discussion (Misc queries) | |||
Taking formula to text | Excel Worksheet Functions | |||
taking one cell and adding text to it | Excel Programming |