Domino Code Fragment

Code Name*
Add Rich Text thru the UI
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.142.173.227
Description*
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Sub Click(Source As Button)

Dim w As New notesuiworkspace
Dim s As New NotesSession
Dim db As notesdatabase
Dim uidoc As notesuidocument
Dim view As notesview
Dim object As notesembeddedobject
Dim doc As notesdocument
Dim col As NotesDocumentCollection
Dim searchdoc As String
Dim DT As New NotesDateTime("1/1/50")
Set db = s.currentdatabase
Set uidoc = w.currentdocument
Dim rtitem As Variant
Set doc = uidoc.Document


'Create New RichTextItem in the current document
Set rtitem = New NotesRichTextItem(doc,"RT")

'Attach the bitmap
Set object = rtitem.EmbedObject ( EMBED_ATTACHMENT, "", "c:\temp\access.txt", "Att" )

'Get the key value from the current document
searchdoc = doc.subject(0)

'Set the form field and save document through backend
Doc.Form = "Add Rich Text through UI"
Call doc.save(False,False)

'Refresh the main view through back end and front end methods
Set view = db.getview("Main")
Call view.Refresh
Call w.viewrefresh

'Set save options to zero so that user does not get prompted to save after closing uidoc
doc.saveoptions = "0"
Call uidoc.close

'Open database to main view, find the document again based on searchdoc and open it up
Call w.OpenDatabase("","","Main",searchdoc,False,True)
Set uidoc = w.Editdocument(True)

'Reset doc and set saveoptions back to "1"
Set doc = uidoc.document
doc.saveoptions = "1"

End Sub