Attach to Rich Text

Hello, I need get attachment from a document 1 and need attach it in a other document 2. I create a buttom that search the first document, extract the attachment to hard disk and now need attach it in the document 2.

The next code is invalid but not show Error, It haven’t result.

I speack spanish and my english is bad, I hope you can understandme. Thanks

Dim Attach1 As NotesRichTextItem

Dim Attach2 As NotesRichTextItem

Set Attach1 = doc.GetFirstItem(“Adjunto”)

If Not Attach1 Is Nothing Then

HayAttach = Attach1.EmbeddedObjects

If Not Isempty(HayAttach) Then

Set Attach2 = docOther.GetFirstItem(“Adjunto”)

If Attach2 Is Nothing Then

Set Attach2 = docOther.CreateRichTextItem(“Adjunto”)

End If

Forall x In Attach1.EmbeddedObjects

If (x.Type = EMBED_ATTACHMENT) Then

p=Path + x.name

Call x.ExtractFile (p)

------->Call Attach2.embedObject(EMBED_ATTACHMENT, “”, p)

Kill p

End If

End Forall

End If

End If

Subject: Attach to Rich Text

Hola Natalia, Debes verificar primero que el comando de extract te esté funcionando, elimina la linea “Kill p” y verifica que se este grabando el attachment al file system. Si esto te está funcionando, creo que lo unico que te falta en el codigo es que no estas llamando el Save del segundo documento~.

Añade la linea

docOther.Save(True,False)

despues del End Forall


Add the line

docOther.Save(True,False)

to save document, this might be the problem

Hope this works