Envoyer un mail via Lotus Notes à partir d'Excel

cs_HarryCover Messages postés 1 Date d'inscription mardi 4 mars 2003 Statut Membre Dernière intervention 1 octobre 2003 - 1 oct. 2003 à 12:14
ricool Messages postés 22 Date d'inscription samedi 8 novembre 2003 Statut Membre Dernière intervention 24 juillet 2005 - 3 juin 2005 à 18:41
Je souhaite pouvoir envoyer un mail à plusieurs personnes en même temps mais je n'arrive pas à mettre plusieurs adresses email(s) dans le champ "Send To". Lorsque j'essaye par exemple ==> toto@yahoo.fr, titi@yahoo.fr, tata@yahoo.fr ==> Ca ne marche pas aucunes valeurs apparaient dans le champ Send To sous Lotus. Voici le Code utilisé :

Workbooks("ITTR_UK_Template.xls").Sheets("Feuil1").Activate

'Déclaration des variables
'--------------------------
Dim Maildb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim Name As String
Dim Surname As String
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself
Dim MyStyle As Object
Dim MyItem As Object
Dim NotesDoc As Object
Dim AttachME As Object 'The attachment richtextfile object
Dim Session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim iPos As Long
Dim ws
Dim servername As String
Dim strCopyTo As String
Dim dbname As String
Dim viewName As String
Dim masque As String
Dim Key As String
Dim EmailAddress As String
Dim strSubject As String
Dim strBody As String
Const EMBED_OBJECT = 1454

strSubject = "ITTR N° " & Range("AA8").Value & " - Information Technologies Technical Request"
servername = "......."
dbname = "........."
viewName = ""
masque = "Memo"
Key = "Current"
EmailAddress = ""
'----------------------------------------------

Set Session = CreateObject("Notes.Notessession")
Set Maildb = Session.GetDatabase(servername, dbname)

Recipient = Range("AB15").Value
strCopyTo = Range("AB18").Value
Maildb.CreateDocument
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
Set MyItem = MailDoc.AppendItemValue("Subject", strSubject)
Set MyItem = MailDoc.AppendItemValue("SendTo", Recipient)
Set MyItem = MailDoc.AppendItemValue("CopyTo", strCopyTo)
Set MyItem = MailDoc.AppendItemValue("BlindCopyTo", "toto@yahoo.fr")
Set MyItem = MailDoc.CreateRichTextItem("Body")
Set MyStyle = Session.CreateRichTextStyle
MailDoc.Font = "Courrier New"
With MyItem
MyStyle.Bold = True
MyStyle.NotesFont = 4
MyStyle.NotesColor = 4
Call MyItem.AppendStyle(MyStyle)
.AppendText "Your request was indeed taken into account." & Chr$(10) & _
"You will find the number of file herewith that we have affected." & Chr$(10) & _
"For all remarks or information concerning this problem, it will be essential to provide us this number:"
.AddNewLine 2
MyStyle.Bold = True
MyStyle.FontSize = 10
MyStyle.NotesColor = 4
Call MyItem.AppendStyle(MyStyle)
.AppendText "Information Technologies Technical Requests Number : "
MyStyle.NotesColor = 2
Call MyItem.AppendStyle(MyStyle)
.AppendText Range("AA8").Value
.AddNewLine 1
MyStyle.NotesColor = 4
Call MyItem.AppendStyle(MyStyle)
.AppendText "Oracle Technical Assitance Requests Number : "
MyStyle.NotesColor = 2
If Range("AC41") <> "" Then
Call MyItem.AppendStyle(MyStyle)
.AppendText Range("AC41").Value
.AddNewLine 2
Else
Call MyItem.AppendStyle(MyStyle)
.AppendText "N/A"
.AddNewLine 2
End If
MyStyle.Bold = False
MyStyle.NotesColor = 4
Call MyItem.AppendStyle(MyStyle)
.AppendText "Flowserve Operating Unit : "
MyStyle.NotesColor = 2
Call MyItem.AppendStyle(MyStyle)
.AppendText Range("I15").Value
.AddNewLine 1
MyStyle.NotesColor = 4
Call MyItem.AppendStyle(MyStyle)
.AppendText "Requestor : "
MyStyle.NotesColor = 2
Call MyItem.AppendStyle(MyStyle)
.AppendText Range("AB15").Value
.AddNewLine 1
MyStyle.NotesColor = 4
Call MyItem.AppendStyle(MyStyle)
.AppendText "Requestor Department : "
MyStyle.NotesColor = 2
Call MyItem.AppendStyle(MyStyle)
.AppendText Range("AA11").Value
.AddNewLine 1
MyStyle.NotesColor = 4
Call MyItem.AppendStyle(MyStyle)
.AppendText "Oracle Module : "
MyStyle.NotesColor = 2
Call MyItem.AppendStyle(MyStyle)
.AppendText Range("I10").Value
.AddNewLine 1
MyStyle.NotesColor = 4
Call MyItem.AppendStyle(MyStyle)
.AppendText "Oracle KeyUser : "
MyStyle.NotesColor = 2
Call MyItem.AppendStyle(MyStyle)
.AppendText Range("AB18").Value
.AddNewLine 1
MyStyle.NotesColor = 4
Call MyItem.AppendStyle(MyStyle)
.AppendText "Request Date : "
MyStyle.NotesColor = 2
Call MyItem.AppendStyle(MyStyle)
.AppendText Range("AB21").Value
.AddNewLine 2
MyStyle.NotesColor = 8
MyStyle.Bold = True
Call MyItem.AppendStyle(MyStyle)
.AppendText "Problem Description"
.AddNewLine 2
MyStyle.Bold = False
MyStyle.NotesColor = 0
MyStyle.FontSize = 10
Call MyItem.AppendStyle(MyStyle)
.AppendText Range("D25").Value
.AddNewLine 2
MyStyle.NotesColor = 8
MyStyle.Bold = True
Call MyItem.AppendStyle(MyStyle)
.AppendText "EDC Actions"
.AddNewLine 2
MyStyle.Bold = False
MyStyle.NotesColor = 0
MyStyle.FontSize = 10
Call MyItem.AppendStyle(MyStyle)
.AppendText Range("D51").Value
.AddNewLine 2
.AppendText "Best Regards,"
.AddNewLine 2
.AppendText "HarryCover"
.AddNewLine 1
.AppendText "Phone : xxxxxxxxxxxx" & Chr$(10) & _
"Fax : xxxxxxxxxxxx" & Chr$(10) & _
"xxxxxxxxxxx" & Chr$(10) & _
"xxxxxxxxxxx"
.AddNewLine 2
End With

Call MyItem.EmbedObject(EMBED_OBJECT, "ITTR Details", Workbooks(1).FullName)
MailDoc.SaveMessageOnSend = True
Response = MailDoc.Save(True, True)
Call MailDoc.Send(0, Recipient)
MailDoc.deliveryreport = 1


'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set MyStyle = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj = Nothing

End Sub

HarryCoverHarryCoverHarryCoverHarryCover

1 réponse

ricool Messages postés 22 Date d'inscription samedi 8 novembre 2003 Statut Membre Dernière intervention 24 juillet 2005
3 juin 2005 à 18:41
Salut,



as tu essayé ca



Dim recip(25) as variant


recip(0) = "emailaddress1"


recip(1) = "emailaddress2" e.t.c





maildoc.sendto = recip



normalement cela fonctionne



voila
0
Rejoignez-nous