Sub Envoi() 'envoie pdf feuille active
Dim OutApp As Object
Dim OutMail As Object
Dim strto As String, strcc As String
Dim strsub As String, strbody As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.createitem(0)
x = ThisWorkbook.Path
fichier = Mid(ActiveWorkbook.Name, 1, Len(ActiveWorkbook.Name) - 4)
Nom = x & "\" & fichier & "-" & ActiveSheet.Name & ".xls"
ActiveSheet.Copy
ActiveWorkbook.SaveAs (Nom)
strto = "xxx@xxx.com" 'déstinataire
If [F28] = "" Then
strcc = ""
Else
strcc = "Fax=" & Range("F28") & "@faxagence.net" 'déstinataire fax client
End If
strsub = "Etude " & Range("A28") 'nom+etablissement
strbody = "Bonjour" & vbNewLine & vbNewLine & _
"Voici l'étude de " & Range("A28") & vbNewLine & vbNewLine & _
"" & vbNewLine & vbNewLine & _
"Cordialement, " & vbNewLine & vbNewLine & _
" " & GetLoginName 'signature
With OutMail
.To = strto
.CC = strcc
.Subject = strsub
.Body = strbody
.Attachments.Add ActiveWorkbook.FullName 'ici
.Display
End With
ActiveWorkbook.Close 0
Application.DisplayAlerts = False
Kill Nom
Application.DisplayAlerts = True
End Sub