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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
AttachMail = "D:\Documents and Settings\wboudgui\Desktop\test-14 aout\fiches-crees\" & nom & ".xls"
strbody = "Information sur la mise à jour"
On Error Resume Next
With OutMail
'mettre display après with et non pas avant sendkeys car sinon le premier fichier n'est pas envoyé
'.Display
' SendKeys "^{ENTER}"
'.Attachments.Add "C:\Users\foufitta\Desktop\test-14 aout\fiches-crees\" & nom & ".xls"
.To = Workbooks("UPIFich.xls").Worksheets("Feuil1").Cells(n, 6).Value
'.To = "wafa.boudguiga@yahoo.fr"
'.CC = "Francois.pignon@free.fr;robin.des.bois@sherwood.gb"
.Subject = "fiche d'imput"
.BodyFormat = olFormatHTML
.HTMLBody = "Bonjour, <BR><BR> voici votre fiche ! "
'' Timer permettant d'attendre que l'envoi soit fait
If AttachMail <> "" Then
.Attachments.Add AttachMail
End If
.Display
SendKeys "^{ENTER}"
End With
Do Until Timer >= 15
DoEvents
Loop
Next
'mettre with avant goto car sinon le premier fichier n'est pas envoyé
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
'Je ne ferme pas outlook pour le laisser finir l'envoi
'Set myOlApp = CreateObject("Outlook.Application")
' myOlApp.Quit
SendKeys "{ENTER}"
SendKeys "^{ENTER}" |
Partager