war zu faul selbst was zu schreiben, also das hier gepastet aus LDD:
The only way to get a handle to the file is to detach it and then reattach it to the other document. To get the files, I use Evaluate("@Attachments",Doc) to get a list of the attachments in the document. Since it returns a list, then I can loop through them..
Hope this helps...
Sub Initialize
Dim Session As New NotesSession
Dim Db As NotesDatabase
Dim Doc As NotesDocument
Dim Object As NotesEmbeddedObject
Dim NewDoc As NotesDocument
Dim vFileNames As Variant
Set Db = Session.CurrentDatabase
Set Doc = Session.DocumentContext
Set NewDoc = DB.CreateDocument
NewDoc.Form = "Testing"
Set rtitem = New NotesRichTextItem( Newdoc, "Body" )
vFileName = Evaluate("@AttachmentNames", doc)
For i = 0 To Ubound(vFileName)
Set Object = Doc.GetAttachment( vFileName(i) )
Call Object.ExtractFile( "c:\temp\" & vFileName(i) )
Set newdocobject = rtitem.EmbedObject _
( EMBED_ATTACHMENT, "", "c:\temp\" & vFileName(i))
Kill "c:\temp\" & vfilename(i)
Next
Call NewDoc.Save(True,True)
End Sub
Quelle:
http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/2036668a1fbfda3e85256c7800459e10?OpenDocumentAndere Lösung, aber eigentlich gleich:
You need to capture the attachment as an object and take it to the field you want (you need to save it temporarily in a folder). The method below does that for all attachments in a field.
Sub RTFTransferDoc(sourcerti As NotesRichTextItem, destrti As NotesRichTextItem)
Dim attmentname As String
Dim tempDrive As String
If Not Isempty(sourcerti.EmbeddedObjects) Then
tempDrive = Curdrive$() & "\AttTempForRTFS"
If Dir$(tempDrive,16) = "" Then
Mkdir tempDrive
End If
Forall o In sourcerti.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
attmentname = tempDrive & "\" & o.Source
Call o.ExtractFile( attmentname )
Call o.remove
Call destrti.EmbedObject( EMBED_ATTACHMENT, "", attmentname)
Kill attmentname
End If
End Forall
'Rmdir tempDrive
End If
End Sub
Quelle:
http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/106404d7ade6b84185256c23002f798c?OpenDocumentAlso immer erst Anhang lösen, dann wieder anhängen