Bonjour à tous,
J'essaye de faire une macro pour envoyer des mails en quantité à des fournisseurs grâce à une macro :
J'ai beau retourner la macro dans tous les sens, je n'arrive toujours pas à paramétrer comme il faut la macro envoi de mail.
La voici :
Sub Send_email()
Call Initialize
Dim toMailList As String
Dim ccMailList As String
Dim attachment_file As String
Dim attachment_picture1 As String
Dim attachment_picture2 As String
Dim oCdo As Object
'Vérification si le fichier doit être créé
While wsFRS.Cells(rowFRS, 1).Value <> ""
If wsFRS.Cells(rowFRS, 2).Value <> "oui" Then GoTo NoMail
FRS = wsFRS.Cells(rowFRS, 1).Value
toMailList = wsFRS.Cells(rowFRS, 3).Value
ccMailList = wsFRS.Cells(rowFRS, 4).Value
attachment_file = folder & "\Suivi_Commande-" & FRS & "-" & year & "S" & week & "-" & day & ".xlsx"
Set oCdo = CreateObject("CDO.Message")
'PreparerOutlook oOutlook
'Set oMailItem = oOutlook.CreateItem(0)
With oCdo
With .Configuration.Fields
.Update
'With oMailItem
'Set .Configuration = CreateObject("CDO.Configuration")
.From = "trucmuche@truc.com"
.To = toMailList
.cc = ccMailList
.Subject = "BackOrder / ABE " & FRS & " " & today_date
.HTMLBody = "<span LANG=FR>" _
& "<p class=style2><span LANG=FR><font FACE=Calibri SIZE=3>" _
& "Bonjour,<br ><br >Voici un récapitulatif de la situation des sites face aux indicateurs appro." _
& "<br> <br>" _
& "<br>La Supply Chain Industrielle<br></font></span>"
.AddAttachment attachment_file 'Excel
.Send
End With
End With
NoMail:
rowFRS = rowFRS + 1
Wend
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
J'ai l'impression que jJe n'arrive pas à relier mon mail / Outlook à mon excel. (J'ai bien coché les paramètres nécessaires)
En espérant avoir été assez clair, merci pour votre aide,
Bonne journée à vous,
CCordialement,