Problem with rtf and attachments

Hello,

Any idea why with this code the attachment is saved at the bottom of the document, instead in the rtf field

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument	

Dim doc As NotesDocument

Dim rtitem As NotesRichTextItem

Dim object As NotesEmbeddedObject

Set uidoc = workspace.CurrentDocument

Set doc = uidoc.document	

Dim CoApp As Variant

Set rtitem = New NotesRichTextItem( doc, "Body" )

CoApp = workspace.OpenFileDialog(False,"Please attach","","","")

Set object = rtitem.EmbedObject _

( EMBED_ATTACHMENT, "", CoApp(0))

uidoc.Document.ReplaceItemValue "Body", CoApp 

Thanks!!!

Subject: I’m not surprised…

I’m not sure what you are trying to achieve in the last line of code, but you are effectively overwriting what you have just placed in the Body field with the name of the file, and in the process changing the Body field from rich text to text.

Subject: corrected

Hello again,

The Body field is empty and the attachment is at the bottom.

Set rtitem = New NotesRichTextItem( doc, "Body" )

	CoApp = workspace.OpenFileDialog(False,"Please attach","","","")

Call rtitem.embedobject(EMBED_ATTACHMENT,"",CoApp(0))