Hi,
I’m new to lotusscript and just finding my way around.
I’m trying to performing the following sequence.
-
Detach terms.pdf from selected files.
-
Detach remaing invoices to local hard drive.
-
Attach all invoices within that directory to a new form for sending out.
I can remove the terms and conditions and save the invoices to the local drive drive but i’m struggling to work out how to attach all the local invoices back into a new form.
Any help appreciated. Code done so far detailed below :
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim coll As NotesDocumentCollection
Dim doc As NotesDocument
Dim eo As NotesEmbeddedObject
Dim RTITEM As NOTESrICHtEXTiTEM
Dim Counter As Integer
Set db=s.CurrentDatabase
Set coll=db.UnprocessedDocuments
For a=1 To coll.count
Set doc=coll.GetNthDocument(a)
Set rtitem = doc.GetFirstItem(“Body”)
Forall o In rtitem.EmbeddedObjects
If o.name = “Terms.pdf” Then
Call o.remove
End If
Call doc.Save( True, True )
End Forall
Next
Counter = 1
For a=1 To coll.count
Set doc=coll.GetNthDocument(a)
Set rtitem = doc.GetFirstItem(“Body”)
Counter = Counter + 1
Forall o In rtitem.EmbeddedObjects
oname="c:\Extracted" + o.name
Call o.ExtractFile( oname )
'Messagebox o.name
End Forall
Next
Dim workspace As New NotesUIWorkspace
Call workspace.ComposeDocument( “”, “”, “ForwardEmail2” )
Dim filename As String
Dim body As NotesRichTextItem
Dim object As NotesEmbeddedObject
Set db = s.CurrentDatabase
Set doc = db.CreateDocument
Set body = doc.CreateRichTextItem(“Body”)
doc.Form = “formularz”
filename$ = Dir$(“c:\Extracted*.*”)
Do While filename$ <> “”
Set object = body.EmbedObject(EMBED_ATTACHMENT, “”, "c:\Extracted" & filename$)
Call doc.Save(True, False)
’ Kill "c:\Extracted" & filename$
filename$ = Dir$(“c:\Extracted*.*”)
Messagebox filename$
Loop
End Sub