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
| Sub Bouton1139_Cliquer()
Dim CdoMessage As CDO.Message
Dim fichier As String
Dim Dest As String
Dim i As Integer
Dim Copie As String
Dim Exp As String
Set CdoMessage = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
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 CdoMessage = New CDO.Message
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 CdoMessage
.Subject = "Signature Convention-Avenant 2016"
.From = Exp
.To = Dest
.CC = Copie
.BCC = ""
.TextBody = "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