Domino 9 und frühere Versionen > ND6: Entwicklung
Mail mit Anhang aus Filesystem erstellen...
reraru:
Hi William!
Na dann habe ich es geschnallt.
Danke und einen schönen Abend!
Gruß René ;D
reraru:
Moin William!
Ich habe das Script mal soweit auf meine Bedürfnisse angepasst.
Jetzt gibt es nur noch einen Fehler. Hier das Script:
--- Code: ---Sub Click(Source As Button)
' Deklaration
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim object As NotesEmbeddedObject
Dim RTItem As Variant
Dim AItem As NotesRichTextItem
Dim pathName As String
Dim pathname2 As String
Dim fileName As String
Dim fileName2 As String
Dim createmail As Boolean
' Settings
Set db = session.CurrentDatabase
Set doc = New NotesDocument( db )
Set doc = db.CreateDocument
Set AItem = New NotesRichTextItem(Doc,"Body")
createmail = 0
Doc.Form = "Memo"
pathName$ = "P:\express\*.*"
pathName2$ = "P:\nachnahme\*.*"
fileName$ = Dir$(pathName$, 0)
fileName2$ = Dir$(pathName2$, 0)
' Auf Expresspaket prüfen und ggf. Attachen, sonst Fehlermeldung!
If filename$ <> "" Then
Do
Call AItem.EmbedObject(EMBED_ATTACHMENT,"", "P:\express\" & fileName$ )
Kill "P:\express\" & fileName$
fileName$ = Dir$()
Loop Until fileName$ = ""
createmail = 1
Else
Messagebox "Keine Express-Dateien vorhanden!" , MB_OK + MB_ICONSTOP + MB_DEFBUTTON1+ MB_APPLMODA , "Fehler"
End If
' Auf Nachnahmepaket prüfen und ggf. Attachen, sonst Fehlermeldung!
If filename2$ <> "" Then
Do
Call AItem.EmbedObject(EMBED_ATTACHMENT,"", "P:\nachnahme\" & fileName2$ )
Kill "P:\nachnahme\" & fileName2$
fileName2$ = Dir$()
Loop Until fileName2$ = ""
createmail = 1
Else
Messagebox "Keine Nachnahme-Dateien vorhanden!" , MB_OK + MB_ICONSTOP + MB_DEFBUTTON1+ MB_APPLMODA , "Fehler"
End If
If createmail = 1 Then
'Adressierung
doc.SendTo = "empfaenger@dpd.net"
doc.subject = "DPD Datenaustausch vom " + Now
' Speichern und tschüß
Call Doc.Save (True,False)
End If
End Sub
--- Ende Code ---
Fehlermeldung: "Illegal Function Call" bei folgdendem Statement:
--- Code: ---fileName2$ = Dir$()
--- Ende Code ---
Habe einfach den Code kopiert und die Variablen um "2" ergänzt.
Hast Du eine Idee was schief läuft?
Gruß René
diali:
mach mal die Settings für fileName2$ direkt vor dem If filename2$ <> "" Then. ich glaube Du hast von Dir$() immer nir eine Instanz.
diali:
Auszug aus der Designer-Hilfe
--- Zitat ---The first call to Dir or Dir$ returns the name of the first file in the specified directory that fits the file name specifications in the fileSpec argument. Then:
Subsequent calls to Dir or Dir$ without an argument retrieve additional file names that match fileSpec. You can call the Dir function with no arguments as either Dir or Dir( ). You can call the Dir$ function with no arguments as either Dir$ or Dir$().
If there are no more file names in the specified directory that match the specification, Dir returns a Variant of DataType 8 (String); Dir$ returns the empty string ("").
If Dir or Dir$ is called without an argument after the empty string has been returned, LotusScript generates an error.
--- Ende Zitat ---
reraru:
Hi Alex!
Du hattest recht! Habe die Settings direkt vor das If gesetzt.
Nun klappt et!
Habe in der Hilfe den Beitrag nicht gefunden.
Die Designer Hilfe ist ja auch echt geil! Nur finde ich oft Dinge nicht auf Anhieb!
Gruß René
Navigation
[0] Themen-Index
[*] Vorherige Sete
Zur normalen Ansicht wechseln