ici j'essaye d'envoyer un courrier à plusieurs destinataires de outlook vba.Problème dans l'envoi du courrier à plusieurs destinataires en même temps à partir de Outlook vba
L'adresse de messagerie du destinataire provient de la colonne A de la feuille Excel. Whne Je cours le code ci-dessous l'erreur "Run Time error 1004; Méthode 'cellules de object'_Global' échoué"
comment envoyer le même courrier à plusieurs destinataires en même temps.
À: [email protected]; [email protected]; [email protected] CC: [email protected]; [email protected] Sujet: Test Mail
Code:
Sub Sendmail()
Dim olItem As Outlook.MailItem
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSht As Excel.Worksheet
Dim sPath As String
Dim iRow As Long
iRow = 1
sPath = "XX"
' // Excel
Set xlApp = CreateObject("Excel.Application")
' // Workbook
Set xlBook = xlApp.Workbooks.Open(sPath)
' // Sheet
Set xlSht = xlBook.Sheets("Sheet1")
Do Until IsEmpty(Cells(iRow, 1))
Recip = Cells(iRow, 1).Value
' subject = Cells(iRow, 2).Value
' Atmt = Cells(iRow, 3).Value '
' // Create e-mail Item
Set olItem = Application.CreateItem(olMailItem)
With olItem
Set olRecip = .Recipients.Add(Recip)
.CC = xlSht.Range("B1")
.subject = "test"
.Display
.Send
End With
' // Close
xlBook.Close SaveChanges:=True
' // Quit
xlApp.Quit
'// CleanUp
iRow = iRow + 1
Loop
Set xlApp = Nothing
Set xlBook = Nothing
Set xlSht = Nothing
Set olItem = Nothing
End Sub
qui offic/fenêtre Courez-vous? – 0m3r
Bureau Windows 8.1 – Sai