Er soll alle Dokumente im Ordner bearbeiten.
Sub Initialize
Dim NotesColl As NotesDocumentCollection
Dim session As New NotesSession
Dim mailbox As New NotesDatabase("","")
Dim current As NotesDatabase
Dim maildoc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim bodyrtitem As NotesRichTextItem
Dim dummy As Variant
Dim i As Integer
Dim doc As NotesDocument
Dim sendto As String
Dim sendas As String
Dim subject As String
Set NotesColl=session.CurrentDatabase.UnprocessedDocuments
^-- Hier sollte er die Dokumente aus dem Ordner nehmen --<
If NotesColl.count>0 Then
Set doc=notescoll.GetFirstDocument
For i = 1 To NotesColl.count
sendas="CN=Agent/O=lwb"
sendto=doc.subject(0)
subject=doc.From(0)
Set bodyrtitem = doc.GetFirstItem("Body")
' get handle to mail.box on the users current mail server
Set current = session.CurrentDatabase
Call mailbox.Open( current.server, "mail.box" )
' Create a new document in the severs mail box
Set maildoc = mailbox.CreateDocument
maildoc.Form = "Memo"
maildoc.From = sendas
maildoc.SendFrom = sendas
maildoc.SendTo = sendto
maildoc.Recipients = sendto
maildoc.Subject = subject
Set rtitem = maildoc.CreateRichTextItem("Body")
Call rtitem.AppendRTItem(bodyrtitem)
maildoc.PostedDate = Now()
maildoc.ComposedDate = Now()
maildoc.DeliveredDate = Now()
maildoc.Principal = sendas
maildoc.EncryptOnSend = False
Call maildoc.Save( True, False )
Call doc.PutInFolder("erledigt",False)
Call doc.RemoveFromFolder("FAXNEU")
Set doc=notescoll.GetNextDocument(doc)
Next i
End If
End Sub