GetNext Method (CDONTS Messages Collection)

The GetNext method returns the next Message object in the Messages collection. It returns Nothing if no next object exists, for example if already positioned at the end of the collection.

Syntax

Set objMessage = collMessages.GetNext( ) 
 
objMessage
On successful return, represents the next Message object in the collection.
collMessages
Required. The Messages collection object.

Remarks

If the GetFirst method has not been called since the Messages collection was initialized, the behavior of the GetNext method is not defined. This can produce unexpected results if the collection is reinitialized with a Set statement in every iteration of a loop. The recommended procedure is to Set an explicit variable for the collection before entering the loop.

If the collection is empty, calling GetNext can produce unexpected results even if GetFirst has been called.