File attachment

I have a file attachment in a Rich Text field in a document. I want to copy this attachment file to another Rich Text field in another document using lotus script. Pl. tell me how can it be done.

Subject: File attachment

Hi,

You can use this code:

Set doc = …

Set Newdoc  = New NotesDocument( db )

With NewDoc

	.Form = "XX"

             ....

	Set rtf = New notesrichtextitem ( NewDoc, "Body")

	Set rtf = doc.GetFirstItem( "Body" )

	Call rtf.CopyItemToDocument( Newdoc, "Body" )

End With	

Karim.

Subject: File attachment

Dim rtitem As NotesRichTextItemDim rtitem2 As NotesRichTextItem

Dim object As NotesEmbeddedObject

Set rtitem = New NotesRichTextItem( newdoc, “Body” )

Set rtitem2 = doc.GetFirstItem( “Body” )

If ( rtitem2.Type = RICHTEXT And doc.HasEmbedded ) Then

Forall o In rtitem2.EmbeddedObjects

Select Case o.Type

Case EMBED_ATTACHMENT

fname = o.Name

Call o.ExtractFile( "C:" & fname )

Set object = rtitem.EmbedObject( EMBED_ATTACHMENT, “”, "C:" & fname )

Kill "C:" & fname

End Select

End Forall

End If

Subject: File attachment

Just copy the rich text field - the attachment will also be copied.

Set notesItem = notesItem.CopyItemToDocument( document, newName$ )

or

Set notesItem = notesDocument.CopyItem( item, newName$ )

VH