Convert Rich-Text Field into HTML Code

I am in the process of converting forms to produce HTML emails. I have been able to recreate the forms for the most part, but am running into an issue with a rich-text field. It’s as if the field is being ignored or not recognized by the script.

This is what I have (abbreviated):

Dim ws As New NotesUIWorkspace

Dim session As New NotesSession

Dim db As NotesDatabase

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim ndoc As NotesDocument

Dim body As NotesMIMEEntity

Dim header As NotesMIMEHeader

Dim stream As NotesStream

Set db = session.CurrentDatabase

Set stream = session.CreateStream

session.ConvertMIME = False

Set uidoc = ws.CurrentDocument

Set doc = uidoc.Document

Set ndoc = db.CreateDocument

ndoc.Form = “Memo”

Call uidoc.Refresh

-Main code here -

Call stream.writetext(|

|)

'Need to fix the RT field to come across correctly!

'Call stream.writetext(|

|)

Call stream.WriteText(|nitem.ContentAsText|)

Call stream.writetext(||)

Call stream.writetext(||)

Call stream.writetext(||)

Call body.SetContentFromText(stream, “text/HTML;charset=UTF-8”, ENC_IDENTITY_7BIT)

Call ndoc.Send(False)

session.ConvertMIME = True

Any help would be greatly appreciated!

TIA,

Chris

| & doc.Body(0) & |

Subject: Convert Rich-Text Field into HTML Code

It look like your current document has not been saved yet, and thus is the contents of a richtext item not yet available.

Subject: Convert Rich-Text Field into HTML Code

The original doc was being saved in the main section of code.