Sub Envoi() 'envoie pdf feuille active
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)
strto = "jerome.prevost@prohygieneservice.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" & " " & Range("B1") & vbNewLine & vbNewLine & _
"Voici l'étude de " & Range("A28") & vbNewLine & vbNewLine & _
"" & vbNewLine & vbNewLine & _
"Cordialement, " & vbNewLine & vbNewLine & _
" " & GetLoginName 'signature
'GetLoginName = Replace(strName, ".", " ") 'BUG objet
With OutMail
.To = strto
.CC = strcc
.Subject = strsub
.Body = strbody
.Attachments.Add Environ("USERNAME") & "\" & sNomFichierPDF
.Display
End With
ActiveWorkbook.Close 0
Application.DisplayAlerts = False
Application.DisplayAlerts = True
Kill sNomFichierPDF
End Sub