3.29 DocumentIterator

Iterates through Documents collections, successively returning each Document object. Multiple DocumentIterator objects can be active on the same collection. Each iterator maintains its own internal position and does not affect the state of the Documents collection over which it is iterating.

3.29.1 Properties

The following table lists properties along with their access and descriptions.






Application. The Application object.



Documents collection. The Documents collection that owns this object.

3.29.2 Methods

DocumentIterator Clone()

Creates an independent DocumentIterator instance. The clone starts at the position last access by the original iterator. Use Clone() to save a position before calling Skip or Reset.

Document Next()

Returns the next document in a collection, or nothing after the last document.


Resets iteration to the collection beginning so that Next() returns the first document.

Skip(Long NumDocuments)

Skips the next NumDocuments documents. Skip does nothing if there are not NumDocuments documents left to skip, or if NumDocuments < 0.

3.29.3 Remarks

Both DocumentIterator and IEnumVARIANT (obtained from the Documents collection's _NewEnum method) provide Documents collection iteration. DocumentIterator objects are accessible in all development environments while IEnumVARIANT is a COM interface inaccessible in environments such as Delphi. The usual alternative to IEnumVARIANT is:

for i:= 1 to Count

This does not work with large collections, such as Documents, which do not support Count or Item.

The DocumentIterator object does not support refresh.