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
| Sub Bouton1139_Cliquer()
Dim CdoMessage As Object
Dim Fichier As Variant
Dim iMsga As Object, iConfa As Object, Fldsa As Object
Dim Dest As String
Dim i As Integer
Dim Copie As String
Dim Exp As String
For i = 7 To 3006
If Sheets("Avenant - Convention").Range("S" & i).Value = "créé" And Sheets("Avenant - Convention").Range("B" & i).Value = Sheets("Avenant - Convention").Range("G3").Value Then
Set iMsga = CreateObject("cdo.message")
Set iConfa = CreateObject("cdo.configuration")
Set Fldsa = iConfa.Fields
With Fldsa
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'remplacez "smtp.nomserveur.fr" par le nom de serveur de votre FAI :
'http://outlook.developpez.com/faq/index.php?page=Configuration#Paras_FAI
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.orange.fr" 'A ADAPTER SELON LE FAI
.Update
End With
Copie = Sheets("Avenant - Convention").Range("ED" & i).Value
Exp = Sheets("Avenant - Convention").Range("EB" & i).Value
Dest = Sheets("Avenant - Convention").Range("EC" & i).Value
LeRep = "P:\M200\R200\Suivi ressources 2016\Relance\176\"
Fichier = LeRep & Sheets("Avenant - Convention").Range("A" & i).Value & ".pdf"
If Dir(Fichier) = "" Then MsgBox "fichier " & Fichier & " non trouvé": Stop
With iMsga
.Subject = "Signature Convention-Avenant 2016"
.From = Exp
.To = Dest
.CC = Copie
.BCC = ""
.HTMLBody = TxtHtml("Bonjour," & _
vbLf & "" & _
vbLf & "Veuillez trouver en pièce jointe le contrat pour l'opération convenue entre nos deux sociétés." & _
vbLf & "Merci de nous le retourner par envoi postal signé et tamponné, en 3 exemplaires originaux." & vbLf & vbLf & _
"Vous en souhaitant bonne réception" & vbLf & vbLf & _
"Cordialement" & vbLf & vbLf & _
vbLf & Sheets("Avenant - Convention").Range("DZ" & i).Value)
.AddAttachment Fichier
.Send
End With
Set CdoMessage = Nothing
Application.ScreenUpdating = True
Sheets("Avenant - Convention").Range("S" & i).Value = "Envoyé"
End If
Next i
End Sub |
Partager