PC Review


Reply
Thread Tools Rate Thread

Do until ... loop not working

 
 
Imran J Khan
Guest
Posts: n/a
 
      17th Feb 2010
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.

 
Reply With Quote
 
 
 
 
Daryl S
Guest
Posts: n/a
 
      17th Feb 2010
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...

--
Daryl S


"Imran J Khan" wrote:

> 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.
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Working with a Loop R Tanner Microsoft Excel Programming 3 30th Aug 2008 12:08 AM
Do Until Loop Not Working =?Utf-8?B?UEpGcnk=?= Microsoft Excel Programming 1 1st Oct 2007 07:20 PM
Loop not working!! =?Utf-8?B?U2ltb24=?= Microsoft Excel Programming 2 2nd Aug 2005 04:16 PM
Do...Loop not working Sunny Lin Microsoft Excel Programming 1 14th Apr 2005 01:19 AM
Do While Loop (ASP.NET) not working L. Oborne Microsoft ASP .NET 5 14th Jul 2004 09:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:43 PM.