Macro excel envoi mail avec fichier joint
Résolu
Utilisateur anonyme
-
Utilisateur anonyme -
Utilisateur anonyme -
A voir également:
- Vba envoyer mail avec pièce jointe
- Mail delivery system - Astuces et Solutions
- Pièce d'identité - Accueil - Services publics
- Gmail envoyer un mail - Guide
- 1 pièce jointe - Guide
- Messenger impossible d'envoyer en jaune - Forum Facebook Messenger
4 réponses
Bonjour,
Cette macro marche parfaitement, j'ai du faire une erreur hier.
Private Sub Bouton6_QuandClic()
Dim y, chemin, nom As String
Dim x As Integer
Dim ol As Object, myItem As Object
chemin = ActiveWorkbook.Path
y = Sheets(1).Range("M1").Value
x = Sheets(1).Range("K1").Value
nom = "contrôle " & Sheets(x).Name
ThisWorkbook.Sheets(x).Copy
ActiveWorkbook.SaveAs chemin & "\" & nom
Set ol = CreateObject("outlook.application")
Set myItem = ol.CreateItem(olMailItem)
myItem.To = y
myItem.Subject = "envoi d'un fichier attaché"
myItem.Body = "Bonjour, " & Chr(10) & "Vous trouverez ci-joint le tableau de Contrôle pour votre service. " & Chr(10) & "Merci de bien vouloir me faire un retour avec vos corrections. " & Chr(10) & "Cordialement, " & Chr(10) & "Elsie "
myItem.Attachments.Add ActiveWorkbook.FullName
myItem.Send
Set ol = Nothing
ActiveWorkbook.Close
End Sub
Merci beaucoup pour ton aide !!
Elsie
Cette macro marche parfaitement, j'ai du faire une erreur hier.
Private Sub Bouton6_QuandClic()
Dim y, chemin, nom As String
Dim x As Integer
Dim ol As Object, myItem As Object
chemin = ActiveWorkbook.Path
y = Sheets(1).Range("M1").Value
x = Sheets(1).Range("K1").Value
nom = "contrôle " & Sheets(x).Name
ThisWorkbook.Sheets(x).Copy
ActiveWorkbook.SaveAs chemin & "\" & nom
Set ol = CreateObject("outlook.application")
Set myItem = ol.CreateItem(olMailItem)
myItem.To = y
myItem.Subject = "envoi d'un fichier attaché"
myItem.Body = "Bonjour, " & Chr(10) & "Vous trouverez ci-joint le tableau de Contrôle pour votre service. " & Chr(10) & "Merci de bien vouloir me faire un retour avec vos corrections. " & Chr(10) & "Cordialement, " & Chr(10) & "Elsie "
myItem.Attachments.Add ActiveWorkbook.FullName
myItem.Send
Set ol = Nothing
ActiveWorkbook.Close
End Sub
Merci beaucoup pour ton aide !!
Elsie