Manage Learn to apply best practices and optimize your operations.

Copy from one rich text to another

This tip shows you how to copy from one rich text to another.

If a document is not saved the rich text item can not be copied from another rich text field. The following code creates a copy of the currently opened document from a view with all of the contents from the rich text field.

  Code: Dim wsp As New NotesUIWorkspace
 Dim curruidoc As NotesUIDocument
 Dim currdoc As NotesDocument
 Dim ns As New NotesSession
 Dim db As NotesDatabase
 Dim item1 As NotesItem
 Set db=ns.CurrentDatabase
 Set curruidoc=wsp.CurrentDocument
 Set currdoc=curruidoc.Document
 Set item1=currdoc.GetFirstItem("att")
 Dim doc As New NotesDocument(db) 
' create a new document in memory.
 Call doc.ReplaceItemValue("Form", "MailAudit")
 Dim rtf As NotesRichTextItem
 Set rtf = New NotesRichTextItem(doc, "att")
 '//for pasting attachmants
 Set rtitem2 = currdoc.GetFirstItem( "att" )
 Call doc.CopyItem( item1, "att" )
 '//end of pasting
' make Notes complete cached rich text changes.
 Call rtf.Update( )
 Dim ws As New NotesUIWorkspace
 Call ws.EditDocument(True, doc)

Do you have comments on this tip? Let us know.

This tip was submitted to the tip exchange by member Milind Sahasrabudhe. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on LotusScript



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...