1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Function EnvoiMail()
' Création d'une variable de type E-Mail :
Dim Email As Outlook.Application
Dim EmailMsg As Outlook.MailItem
Dim Dest As Outlook.Recipient
'Dim col As Variant
Set Email = CreateObject("Outlook.Application")
Set EmailMsg = Email.CreateItem(olMailItem)
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
ChDir ("C:\FichierProjet.txt")
chem = CurDir
chemin = chem & "\" & Nfichier
Set Email = CreateObject("Outlook.Application")
Set EmailMsg = Email.CreateItem(olMailItem)
' Création de l'e-mail : Titre, Corps du message, destinataire
Set Dest = "toto@cunexemple.com"
EmailMsg.Subject = "Fichier texte de " & Nomconsultant & Prénomconsultant
EmailMsg.Attachments.Add chemin
EmailMsg.CC = "test.toto@yahoo.fr"
' Placement de l'e-mail dans la boîte d'envoi :
EmailMsg.Send
'EmailMsg.Attachments
Set EmailMsg = Nothing
Set Email = Nothing
End Function |
Partager