473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
Jul 17 '05 #1
5 4979
"Orin Hargraves" <or****@carr.org> 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! =-----
Jul 17 '05 #2
On 11 Dec 2003 08:24:41 -0800, or****@carr.org (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]
Jul 17 '05 #3
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" <or****@carr.org> wrote in message
news:37**************************@posting.google.c 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
Jul 17 '05 #4
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
Jul 17 '05 #5
"Orin Hargraves" <or****@carr.org> 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! =-----
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Invalid User | last post by:
While trying to print a none empty list, I accidentaly put an "else" statement with a "for" instead of "if". Here is what I had: if ( len(mylist)> 0) : for x,y in mylist: print x,y else:...
3
by: Phil | last post by:
Hi everybody, I am a XSLT beginner and the following problem really makes me crazy ! I have a main "contacts.xml" document which contains references to several contact data XML files. My aim...
8
by: lancevictor | last post by:
I'm learning javascript, and toward that end, I am recreating a page "my way". The original page: http://stenbergcollege.com and the one that I'm creating:...
32
by: Toby Newman | last post by:
At the page: http://www.strath.ac.uk/IT/Docs/Ccourse/subsection3_8_3.html#SECTION0008300000000000000 or http://tinyurl.com/4ptzs the author warns: "The for loop is frequently used, usually...
3
by: songie D | last post by:
would it be possible to sort of engineer some sort of preprocessor macro that does a 'for' loop. i.e. for where you would normally use a normal for loop, but when it is known ay compile time whay...
12
by: Robbie Hatley | last post by:
I'm getting a bizarre error with this code: ... case WM_COMMAND: { switch (LOWORD(wParam)) // switch (control ID) { ... case IDC_RAIN_ENABLE_SIMPLE: {
5
by: Fabian Vilers | last post by:
Hi again... I'm wondering what could be better in terms of performance between: var my_array = new Array(); // populate array for (index in my_array) { // do something with my_array
34
by: Frederick Gotham | last post by:
Is the domestic usage of the C "for" loop inefficient when it comes to simple incrementation? Here's a very simple program that prints out the bit-numbers in a byte. #include <stdio.h> #include...
9
by: PengYu.UT | last post by:
Hi, I have the code below this email. I want to replace the last 4 lines with a Metaprogramming loop to get something like the following (I don't know the syntax). Is it possible? for type in...
15
by: Steve | last post by:
I am having problems getting values out of an array. The array is set as a global array and values are pushed into it as they are read from a JSON file using a "for loop". When the "for loop" is...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.