par clementbp » 03 Nov 2010 à 15:07
Merci cette fois je recois bien le mail c'est super
Par contre pour le cas des pièces jointes je ne comprend toujours pas comment je dois faire.
j'ai deux solutions, soit je fais un champs texte riche qui s'appel CorpsTexte dans lequel je peut joindre des fichiers (je l'ai fais et j'ai un message d'erreur), ou alors je mets toutes mes pieces jointes dans un champs de type texte riche amélioré.
Comment faire :
Pour info le code a mettre dans le bouton du masque est :
Sub Click(Source As Button)
On Error Goto ErreurHandle
Dim session As NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim rtItem As NotesRichTextItem
Dim uiwork As New Notesuiworkspace
Set session = New NotesSession
Set db = session.CurrentDatabase
Set doc = uiwork.currentDocument.document
If doc Is Nothing Then
Error 9999,"doc is Nothing"
Elseif doc.HasItem("CorpsTexte") = False Then
Error 9999, "No field : CorpsTexte"
End If
Dim nbCopy As Boolean
nbCopy = False
Dim memo As NotesDocument
Set memo = New NotesDocument( db )
If nbCopy = False Then
'si pas de Piece jointe
Call memo.ReplaceItemValue( "Body", doc.GetItemValue( "CorpsTexte" ))
Else
'si piece jointe
Set rtItem = doc.GetFirstItem("CorpsTexte")
If Not rtItem Is Nothing Then
Call rtItem.CopyItemToDocument(memo,"Body")
End If
End If
Call memo.ReplaceItemValue( "Subject", "Objet du mail" )
Call memo.ReplaceItemValue( "Form", "Memo" )
Call memo.Send( False, "clement@aaaa.fr" )
Exit Sub
ErreurHandle:
Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
Exit Sub
End Sub