Lotus Notes FAQ Visit Our Sponsor!

How do you refresh RichText fields in a UI document?

Other field types get refreshed when you call the uidoc.Refresh method. However, with RichText fields, you have to close the document and reopen it (the user will see a flicker as you do this). Here is an example of how to do this:

Dim s As New NotesSession 'reference to the current session
Dim db As NotesDatabase 'reference to the current database
Dim ws As New NotesUIWorkspace 'reference to the current orkspace
Dim uidoc As NotesUIDocument 'reference to the current UI document
Dim doc As NotesDocument 'the back-end document open in the UI

  'set db equal to the currently open database found in the current session
  Set db = s.currentdatabase
  'set the uidoc equal to the currently open uidoc
  Set uidoc = ws.currentdocument
  'set doc equal to the document open in the uidoc
  Set doc = uidoc.document

' *** make your changes to the doc object here ***

  'Save the document
  Call doc.Save(False,False)
  ' grab the document's UNID
  Dim DocUNID As String
  DocUNID = doc.UniversalID

  'Set the saveoptions so that the user is not prompted when the document closes.
  doc.SaveOptions = "0"

  'Close the document in the UI
  Call uidoc.Close

  ' get the document back
  Set doc = db.GetDocumentByUNID(DocUNID)

  'Re-open the document in the UI
  Set uidoc = ws.EditDocument(True, doc)


Applies to Notes Versions: 4.5 4.6 5
Last Modified: July 18, 1997