%INCLUDE "lsconst.lss" Sub Initialize Dim session As NotesSession Dim db As NotesDatabase Dim dc As NotesDocumentCollection Dim doc As NotesDocument Dim stream As NotesStream Dim pathname As String pathname = "c:\StreamFiles\" Set session = New NotesSession Set db = session.CurrentDatabase Set dc = db.UnprocessedDocuments Set doc = dc.GetFirstDocument Set stream = session.CreateStream pathname = pathname & doc.GetItemValue("Subject")(0) & ".txt" If Not stream.Open(pathname, "ASCII") Then Messagebox pathname,, "Open failed" Exit Sub End If If stream.IsReadOnly Then Messagebox pathname,, "File is read-only" Exit Sub End If If stream.Bytes <> 0 Then If Messagebox("Do you want to abort?", _ MB_YESNO + MB_ICONQUESTION, _ "File exists and has content?") = IDYES Then Exit Sub End If If Messagebox("Do you want to replace the old content?", _ MB_YESNO + MB_ICONQUESTION, _ "Rewrite or append?") = IDYES Then Call stream.Truncate Else Call stream.WriteText(Chr(13) & Chr(10)) End If End If Call stream.WriteText(doc.GetItemValue("Body")(0)) Call stream.Close End Sub