stopping a "For Each" loop at EOF

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Orin Hargraves

    stopping a "For Each" loop at EOF

    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
  • Larry Serflaten

    #2
    Re: stopping a "For Each" loop at EOF

    "Orin Hargraves" <orinkh@carr.or g> wrote in message[color=blue]
    > 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.[/color]


    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! =-----

    Comment

    • J French

      #3
      Re: stopping a &quot;For Each&quot; loop at EOF

      On 11 Dec 2003 08:24:41 -0800, orinkh@carr.org (Orin Hargraves) wrote:
      [color=blue]
      >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[/color]

      Type in EOF then press [F1]


      Comment

      • Randy Birch

        #4
        Re: stopping a &quot;For Each&quot; loop at EOF

        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

        Please respond only to the newsgroups so all can benefit.


        "Orin Hargraves" <orinkh@carr.or g> wrote in message
        news:37b8544f.0 312110824.7b6d3 ae9@posting.goo gle.com...
        : 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


        Comment

        • Orin Hargraves

          #5
          Re: stopping a &quot;For Each&quot; loop at EOF

          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

          Comment

          • Larry Serflaten

            #6
            Re: stopping a &quot;For Each&quot; loop at EOF

            "Orin Hargraves" <orinkh@carr.or g> wrote[color=blue]
            > 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.[/color]


            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! =-----

            Comment

            Working...