Go Back   Forum Care Forums > Development Reference Area > Visual Basic

Reply
 
LinkBack Thread Tools Display Modes
stopping a "For Each" loop at EOF
Old
  (#1)
Orin Hargraves
Guest
 
Posts: n/a
Default stopping a "For Each" loop at EOF - 06-04-2007, 08:56 AM

I'm formatting data in a text file using a "For Each aPara" statement
along with a "Next aPara." How do I make the thing stop when it
reaches the end of the file, rather than starting again at the top of
the file and looping forever? Thanks, I'm new at this.

Orin Hargraves
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: stopping a "For Each" loop at EOF
Old
  (#2)
Larry Serflaten
Guest
 
Posts: n/a
Default Re: stopping a "For Each" loop at EOF - 06-04-2007, 08:56 AM

"Orin Hargraves" <EMAIL REMOVED> wrote in message
> I'm formatting data in a text file using a "For Each aPara" statement
> along with a "Next aPara." How do I make the thing stop when it
> reaches the end of the file, rather than starting again at the top of
> the file and looping forever? Thanks, I'm new at this.



For each para in WHAT ??

What are you looping through? What is each item?

LFS





-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: stopping a "For Each" loop at EOF
Old
  (#3)
J French
Guest
 
Posts: n/a
Default Re: stopping a "For Each" loop at EOF - 06-04-2007, 08:56 AM

On 11 Dec 2003 08:24:41 -0800, EMAIL REMOVED (Orin Hargraves) wrote:

>I'm formatting data in a text file using a "For Each aPara" statement
>along with a "Next aPara." How do I make the thing stop when it
>reaches the end of the file, rather than starting again at the top of
>the file and looping forever? Thanks, I'm new at this.
>
>Orin Hargraves


Type in EOF then press [F1]


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: stopping a "For Each" loop at EOF
Old
  (#4)
Randy Birch
Guest
 
Posts: n/a
Default Re: stopping a "For Each" loop at EOF - 06-04-2007, 08:56 AM

This tells us nothing. aPara is not a VB 'thingy', so you're using something
either incorrectly, or that you obtained to wrap certain functionality.
Since we do not have whatever this is, your question provides no
information.

--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.


"Orin Hargraves" <EMAIL REMOVED> wrote in message
news:EMAIL REMOVED om...
: I'm formatting data in a text file using a "For Each aPara" statement
: along with a "Next aPara." How do I make the thing stop when it
: reaches the end of the file, rather than starting again at the top of
: the file and looping forever? Thanks, I'm new at this.
:
: Orin Hargraves


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: stopping a "For Each" loop at EOF
Old
  (#5)
Orin Hargraves
Guest
 
Posts: n/a
Default Re: stopping a "For Each" loop at EOF - 06-04-2007, 08:56 AM

Sorry to be vague. My complete "for each" statement is

For Each aPara In ActiveDocument.Paragraphs

Which iterates a number of editing functions in each record in the
open text file (the records corresponding to paragraphs as far as Word
is concerned). The

Next aPara

statement at the end causes the looping; but I want the loop to stop
at the end of the file, not start over again at the top and do it all
again.

Thanks,
Orin
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: stopping a "For Each" loop at EOF
Old
  (#6)
Larry Serflaten
Guest
 
Posts: n/a
Default Re: stopping a "For Each" loop at EOF - 06-04-2007, 08:56 AM

"Orin Hargraves" <EMAIL REMOVED> wrote
> Sorry to be vague. My complete "for each" statement is
>
> For Each aPara In ActiveDocument.Paragraphs
>
> Which iterates a number of editing functions in each record in the
> open text file (the records corresponding to paragraphs as far as Word
> is concerned). The
>
> Next aPara
>
> statement at the end causes the looping; but I want the loop to stop
> at the end of the file, not start over again at the top and do it all
> again.



Is that what happens? I don't work with Word like that, but I often
use the For/Each methods. For/Each is designed to loop through the
entire contents 1 time, in every application I have seen it. If you find
it is going back to the top (without you telling it to) then that implementation
is far different than every other example I have seen. Double check your
code (step through it using F8) to be sure you don't accidentally tell it
to start over somewhere....

LFS





-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

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 On





Contact Us - Forum Care Forums - Archive - Top