Re: Do loops and omit a couple of iterations?



On 12 Feb., 20:32, "Jay Freedman" <jay.freed...@xxxxxxxxxxx> wrote:
It's possible, but not with that kind of syntax. There's a Step option in
the For syntax, but that affects every iteration. Instead, place the
contents of the loop in an If...Then clause like this:

Dim i as integer
For i = 1 to 7
If (i <> 3) And (i <> 4) Then
Set tbl = ActiveDocument.Tables(i)

If tbl.Rows(1) etc. then
'do stuff
End If
End If
Next i

Another possibility, when you have more than just a few items to skip over,
is to use a Select Case clause.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.



andreas wrote:
I wonder whether it is possible to iterate through a collection of
objects and omit a couple of iterations, such as

Dim i as integer
For i = 1 to 7 Skip 3,4

Set tbl = ActiveDocument.Tables(i)

If tbl.Rows(1) etc. then
do stuff

End If

Next i

Is this possible, ie. skip the third and fourth table ? `

Help is appreciated. Thank you very much in advance.

Regards,

Andreas- Zitierten Text ausblenden -

- Zitierten Text anzeigen -

Jay,

I inadvertently forgot to say thank you for your valuable help. It is
working fine. Thank you!

.



Relevant Pages

  • Re: LOOP blows!
    ... The order of initialization follows the ... There are two `initializations' in execution of LOOP, ... before staring the first iteration. ... |> The first for clause will never terminate. ...
    (comp.lang.lisp)
  • Re: LOOP blows!
    ...     clauses appear in the source. ... This clause is not combined with the ... Right, and ``People'' includes the ones implementing LOOP, apparently, ... You must use your hidden list iteration variable to set up the ...
    (comp.lang.lisp)
  • RE: Still having probs with SQL and Variables...
    ... Dim stas String ... you could also create a short loop to load all table field names ... I can't seem to get the WHERE clause to refer to the value stored ...
    (microsoft.public.access.queries)
  • RE: Still having probs with SQL and Variables...
    ... I've never used an array before so this seems ... > Dim db as DAO.Database ... > loop and reDim stif necessary to be more flexible. ... I can't seem to get the WHERE clause to refer to the value stored ...
    (microsoft.public.access.queries)
  • Re: LOOP blows!
    ... My understanding of the LOOP specification is that your expectation is ... Even if the FOR Y = X clause were to work by stepping a hidden integer ... and evaluating at every iteration to pull out the ... The problem with these implementations that return NIL is that they ...
    (comp.lang.lisp)