Do until ... loop not working

I

Imran J Khan

I am trying to build a routine which reads a text file and parses and deletes
data from it, untill there is not data left in the text file. However, my
loop continues to run past when the text file is "" and I need it to stop
when the file is "".
I assign the contents of the file to the variable strText which is declared
at the option explicit section before any of the subs/functions.

I have the following code for the loop
Do until strText = ""
'does various things
Loop

Have I misunderstood how this is supposed to work.

If I change the the code as below
Do until not (strText = "")

This works if I make the change during debugging, but exits the loop without
extracting data because the strText is not empty.
I am chasing my on tail again. Help.
 
D

Daryl S

Imran -

Should you be testing for end of file (.EOF) instead of an empty string? Is
this set up as a recordset? Do you have a 'MoveNext' in there? We don't
have enough information to help you...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top