With the latest round of updates, Microsoft have managed to introduce a
nasty problem into the way collections (some Word collections, anyway) are
handled. It used to be that For each ... Next was guaranteed to iterate
every member of the collection. This is no longer the case. It seems that
now, some actions taken on a collection member cause the collection to be
rebuilt, so the loop processes the first member endlessly.
Try this --
For i = 1 to oApp.ActiveDocument.Revisions.Count
Set oRvs = oApp.ActiveDocument.Revisions(i)
:
Next
> I have an Access routine, using automation to approve only deletinos in a
> word document. I am having a problem with certain documents getting stuck in
[quoted text clipped - 6 lines]
> Next
> THANKS in advance for your help!
Klaus Linke - 14 Jan 2005 23:55 GMT
Hi Jezebel, TRM,
I don't know if it's a recent problem... There always have been problems with
some collections when you removed items from them while looping (while other
collections didn't mind).
With the revisions, I wouldn't have expected problems.
But revisions can be problematic to loop if some of the revisions are in tables.
If Jezebel's code doesn't work properly eiter, you might look if there are
tables in the problematic docs.
Maybe try to ignore the deletions for the time being, if they are in a table --
looking at .Information(wdWithInTable).
Just grasping at straws, but you could also try whether
For Each oRvs In oApp.ActiveDocument.Revisions
With oRvs
If .Type = wdRevisionDelete Then .Accept
End With
Next
works better (making doubly sure that you refer to the same revision both
times).
Greetings,
Klaus
> With the latest round of updates, Microsoft have managed to introduce a
> nasty problem into the way collections (some Word collections, anyway) are
[quoted text clipped - 22 lines]
> > Next
> > THANKS in advance for your help!
TRM - 15 Jan 2005 05:59 GMT
Thank you both for your responses! I appreciate it! There is a small table
in the doc/template. I'll "play" with both & respond back!
> Hi Jezebel, TRM,
>
[quoted text clipped - 48 lines]
> > > Next
> > > THANKS in advance for your help!