Dim s As New notessession
Dim dbMail As notesdatabase
Dim NewMails As notesdocumentcollection
Dim mail As notesdocument
Set dbMail=s.currentdatabase
Set NewMails=dbMail.unprocesseddocuments
Set mail=NewMails.GetFirstDocument
While Not mail Is Nothing
mail.Name="YYY"
mail.save True, True
Call s.UpdateProcessedDoc( mail )
Set mail=NewMails.GetNextDocument(mail)
Wend