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
| Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'En supposant que les adresses courriels sont en colonne J
If Range("O3") > "" And InStr(1, Cells(Target.Row, 15), "@") > 0 Then
MsgBox "Il y a une adresse courriel sur la ligne " & Target.Row
EnvoimailMLKB
Else
MsgBox "Il n'y a pas d'adresse courriel sur la ligne " & Target.Row
End If
Target.Offset(1, 0).Select
End Sub
Sub EnvoimailMLKB()
Workbooks("XXXX.xls").Activate
Application.Run ("'ENREGISTRERMODIFETMAILMLKB'")
Dim destinataire As String, sujet As String, body As String, fichierjoint As String, strcommand As String
destinataire = Range("O" & ActiveCell.Row)
sujet = "RESULTAT COMMISSION XXXX"
body = "XXXX" & " " & Range("J2") & " " & Range("K2") & vbCrLf & vbCrLf & "Madame, Monsieur" & vbCrLf & vbCrLf & "Je vous prie de bien vouloir trouver, ci-joint, XXXX"
fichierjoint = "C:\Documents and Settings\XXXX\Bureau\XXXX.pdf"
strcommand = "C:\Program Files\Mozilla Thunderbird\thunderbird"
strcommand = strcommand & " -compose " & "to='" & destinataire & "'"
strcommand = strcommand & ",subject='" & sujet & "'"
strcommand = strcommand & ",body='" & body & "'"
'strcommand = strcommand & "," & "attachment=file:///" & fichierjoint
strcommand = strcommand & "," & "attachment=file:///" & fichierjoint
Debug.Print strcommand
Call Shell(strcommand, vbNormalFocus)
End Sub |
Partager