How to copy richtext element to another document

In a view, with selected entries, I click on my button (action) and it pop up a Dialogbox with a form to fill. After that, I want to create some document with the data of my dialogbox form. But when I want to copy my richtext element, I get the error “Object variable not set”.

If I try to see my document in debug mode. I don’t see my field “Body”.

Here my code (btw, it’s a little bit in french)


If Ws.DialogBox(“OUT”,True , True , , , , False, "Envoi vers ", DocOUT, True, , True) Then

While Not hdoc Is Nothing

  Set envoi = Db.CreateDocument()

  Set envoi = New NotesDocument(db)

  Call DocOUT.CopyAllItems(envoi, True)

  Set rtitem = docOUT.GetFirstItem( "Body" )

  Set rtitemC = rtitem.CopyItemToDocument( envoi, "Body")	

  envoi.Username = hdoc.GetFirstItem("CL_Username").text

  envoi.company = hdoc.GetFirstItem("CL_Company").text

  Call envoi.Save(True, False)

  Set hdoc = hdc.GetNextDocument(hdoc)

Wend

End If


It’s not complicated. I want to create like a number of document depending of my selection and in each I want to put a richtext with the same data from my dialogbox form.

thx

Subject: how to copy richtext element to another document

Can you post the complete code?

I’m not seeing lines such as Dim docOUT and Dim rtitem.

Thanks