kromei
Messages postés27Date d'inscriptiondimanche 13 janvier 2008StatutMembreDernière intervention19 juillet 2010
-
7 juil. 2010 à 10:40
kromei
Messages postés27Date d'inscriptiondimanche 13 janvier 2008StatutMembreDernière intervention19 juillet 2010
-
7 juil. 2010 à 13:30
voila j ai une fonction vba sous excel que j ai recuperé qui permet a priori d envoyer un mail je la met donc dans module1 , je l apelle ensuite dans ma feuil2 , cette fonction a plusieurs arguments en entrée
soit je les rentre
et la erreur il me sort " = attendu" je n arrives pas a m en sortir avec ça donc voici la fonction puis l appel de celle ci:
Public Sub SendNotesMail(subject As String, Attachment As String, BodyText As String, SaveIt As Boolean)
'Set up the objects required for Automation into lotus notes
Dim Recipient(2) As Variant
Recipient(0) = "david.bastien@thalesaleniaspace.com"
Recipient(1) = "eno.lionel@thalesaleniaspace.com"
Dim mailDb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'THe current users notes mail database name
Dim mailDoc As Object 'The mail document itself
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
'Start a session to notes
Set Session = CreateObject("Notes.NotesSession")
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
'Open the mail database in notes
Set mailDb = Session.GETDATABASE("", MailDbName)
If mailDb.IsOpen = True Then
'Already open for mail
Else
mailDb.OPENMAIL
End If
'Set up the new mail document
Set mailDoc = mailDb.CREATEDOCUMENT
mailDoc.Form = "Memo"
mailDoc.sendTo = Recipient '"Jean-Marc LUCIEN/AC750/REC" 'Recipient
mailDoc.subject = subject
mailDoc.body = BodyText
mailDoc.ReturnReceipt = "1"
mailDoc.SAVEMESSAGEONSEND = SaveIt
'Set up the embedded object and attachment and attach it
'Attachment = "e:\Atelier\EnvoiCourrierParLotus\DIFI_COUR_COTG.xls" 'txtFromEmailAddress
'If Attachment <> "" Then
' Set AttachME = mailDoc.CREATERICHTEXTITEM("Attachment")
' Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")
' mailDoc.CREATERICHTEXTITEM ("Attachment")
' End If
'Send the document
mailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder
mailDoc.SEND 0, Recipient
'Clean Up
Set mailDb = Nothing
Set mailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing
End Sub
SendNotesMail ("subject", "", "corps du message", True)
l appel apparait donc en rouge
A voir également:
Incompréhension de la reaction à l appel de fonction