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
| Private Sub CommandButton12_Click() 'Envoi direct avec signature outlook
' Nécessite la référence : Microsoft Outlook 1x Object Library
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim CurFile As String
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
' "C:\Users\Thierry\AppData\Local\Temp\MaFeuille.pdf "
CurFile = ThisWorkbook.Path & "\" & "Planning Adaptel.Pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=CurFile, _
Quality:=xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
With olMail
.To = ActiveSheet.Range("F10")
.CC = ActiveSheet.Range("F11")
.subject = "Planning Adaptel"
.Body = Sheets("données").Range("J2")
.Display
.BodyFormat = 2
.GetInspector.CommandBars.item("Insert").Controls("Signature").Controls(1).Execute
.Attachments.Add CurFile
'.Attachments.Add "c:\My Documents\book.doc"
.Display '.Send
End With
' Effacer les variables objets
Set olMail = Nothing
Set olApp = Nothing
End Sub |
Partager