Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim strm As NotesStream
Dim doc As NotesDocument
Dim col As Notesdocumentcollection
Dim coll As NotesDocumentCollection
Dim parentDoc As NotesDocument
Dim i As Integer
Dim ex As NotesDXLExporter
i = 0
Set db = session.CurrentDatabase
Set col=db.UnprocessedDocuments
Set doc = col.GetFirstDocument
While i < db.UnprocessedDocuments.Count
If doc.IsResponse = True Then
While doc.IsResponse = True
Set parentDoc = doc.ParentDatabase.GetDocumentByUNID(doc.ParentDocumentUNID)
coll.AddDocument(doc)
If Not col.getDocument( parentDoc ) Is Nothing Then
coll.AddDocument(parentDoc)
End If
Set doc=col.GetNextDocument(doc)
i=i+1
Wend
Set strm=session.CreateStream
file$="d:\Temp\Document" & i+1 & ".xml"
Call strm.Open(file$)
Call strm.Truncate
Set ex = session.CreateDXLExporter(coll ,strm)
i = i + 1
Call ex.Process
Call strm.Close
End If
Set strm=session.CreateStream
file$="d:\Temp\Document" & i+1 & ".xml"
Call strm.Open(file$)
Call strm.Truncate
Set ex = session.CreateDXLExporter(doc ,strm)
i = i + 1
Call ex.Process
Call strm.Close
Set doc=col.GetNextDocument(doc)
Wend
Messagebox"Созданно " & i & " xml файла"
End Sub