Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim ec As NotesViewEntryCollection
Dim e As NotesViewEntry
Dim doc As NotesDocument
Dim NDXLExporter As NotesDXLExporter
Dim stream As NotesStream
Dim pathname As String
Set NDXLExporter = session.CreateDXLExporter
NDXLExporter.ForceNoteFormat = False
NDXLExporter.OutputDOCTYPE = False
Set stream = session.CreateStream
Set db = session.CurrentDatabase
Set view = db.GetView("vins")
Set ec = view.AllEntries
Set e = ec.GetFirstEntry
While Not e Is Nothing
Set doc = e.Document
pathname = "c:\StreamFiles\" & doc.UniversalID & ".txt"
If Not stream.Open(pathname) Then
Messagebox pathname,, "Open failed"
Exit Sub
End If
If stream.Bytes <> 0 Then
Messagebox pathname,, _
"File already exists and has content"
Exit Sub
End If
Call stream.WriteText(NDXLExporter.Export(doc))
Set e = ec.GetNextEntry(e)
Wend