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
| 'Document Terminé.
If MsgBox("Envoyer le Document ?", vbYesNo + vbQuestion, "Envoi du document") = vbYes Then
'Définition des variables
Fichier = "C:\temp\Document.pdf"
Corps = ActiveDocument.Tables(1)
'Export du fichier actif en pdf
ActiveDocument.ExportAsFixedFormat OutputFileName:=Fichier, ExportFormat:= _
wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
Item:=wdExportDocumentWithMarkup, IncludeDocProps:=False, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
'Démarrage de l'automatisation Outlook :
Set myApp = CreateObject("Outlook.Application")
Set myItem = myApp.CreateItem(olMailItem)
myItem.Subject = "Envoi du Document"
myItem.Body = Corps
myItem.Attachments.Add Fichier
myItem.Display
End If |
Partager