LOTUSSCRIPT/COM/OLE CLASSES
%INCLUDE "lserr.lss" Sub Initialize On Error ErrFileNotFound Goto handler filename$ = Inputbox$("Full path name of file", "File name") If filename$ = "" Then Exit Sub 'Raise error if file does not exist v = Getfileattr(filename$)_ Dim session As New NotesSession Dim db As NotesDatabase Set db = session.CurrentDatabase Dim dc As NotesDocumentCollection Set dc = db.UnprocessedDocuments Dim doc As NotesDocument Set doc = dc.GetFirstDocument Dim rti As NotesRichTextItem Set rti = doc.GetFirstItem("Body") Dim stream As NotesStream Set stream = session.CreateStream Dim rtstyle As NotesRichTextStyle Set rtstyle = session.CreateRichTextStyle rtstyle.Bold = True Dim colorObject As NotesColorObject Set colorObject = session.CreateColorObject colorObject.NotesColor = COLOR_RED If Not stream.Open(filename$) Then Messagebox "Could not open stream",, "Error" Exit Sub End If Call rti.BeginSection(filename$, rtstyle, colorObject, True) Call rti.AppendText(stream.ReadText) Call rti.EndSection Call doc.Save(True, True) Exit Sub handler: Messagebox "File mistyped or does not exist",, _ "File not found" Exit Sub End Sub
See Also