Ich poste jetz einfach mal den kompletten Code. Es funktioniert nämlich überhaupt nicht! ahhhhh!
Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
Dim uiwork As New NotesUIWorkspace
Dim uiview As NotesUIView
Dim strViewName As String
Set uiview = uiwork.CurrentView
strViewName = uiview.ViewName
Select Case strViewName
Case "AdvancedArchiv":
returnvalue = Messagebox("Aus dieser Ansicht können keine Dokumente gelöscht werden!",MB_OK, "Fehler beim löschen...")
continue = False
Case "Archiv":
Dim doccoll As NotesDocumentCollection
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set doccol = uiview.Documents
If doccol.Count = 0 Then
Set db = session.CurrentDatabase
Set doccoll = db.UnprocessedDocuments
Set doc = doccoll.GetFirstDocument
Else
Set doc = doccol.GetFirstDocument
End If
Dim nextDoc As NotesDocument
Dim responses As NotesDocumentCollection
Dim dummy As NotesDocument
Dim tmpdoc As NotesDocument
Do While Not (doc Is Nothing)
Set responses = doc.Responses
Set dummy = responses.GetFirstDocument
While Not (dummy Is Nothing)
Set tmpdoc = responses.GetNextDocument(dummy)
Call dummy.Remove(True)
Set dummy = tmpdoc
Wend
Set nextDoc = doccoll.GetNextDocument(doc)
Call doc.Remove(True)
Set doc = nextDoc
Loop
continue = True
End Select
End Sub